/* 本文件由 templates/index.html 的内联 <style> 迁移而来；加载顺序必须早于 design-system.css / workspace.css（workspace.css 是对它的覆盖层） */
:root {
    /* 动物森友会配色系统 */
    --bg: #f8f8f0;
    --card-bg: rgb(247, 243, 223);
    --border: #d4c9b4;
    --border-light: #e5dec8;
    --text: #725d42;
    --text-heading: #794f27;
    --text-secondary: #9f927d;
    --text-muted: #c4b89e;
    --primary: #19c8b9;
    --primary-hover: #3dd4c6;
    --primary-active: #11a89b;
    --primary-light: #e6f9f6;
    --primary-3d: #0e9e95;
    --danger: #e05a5a;
    --danger-active: #c94444;
    --danger-bg: #fff5f5;
    --success: #6fba2c;
    --success-active: #5a9e1e;
    --success-bg: #f4faf0;
    --warning: #f5c31c;
    --warning-active: #dba90e;
    --warning-bg: #fffdf5;
    --focus: #ffcc00;
    --focus-dark: #e0b800;
    --shadow-3d: #bdaea0;
    --shadow-btn: rgba(61, 52, 40, 0.06);
    --shadow-btn-hover: rgba(61, 52, 40, 0.10);
    --radius-btn: 50px;
    --radius-card: 20px;
    --radius-sm: 16px;
    --radius-xs: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: Nunito, 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
    font-weight: 500;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(25, 200, 185, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, rgba(136, 157, 240, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(247, 205, 103, 0.04) 0%, transparent 50%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.01em;
    /* 用 flex 精确分配高度，避免硬编码 calc 造成的 1~2px 溢出与滚动条 */
    display: flex;
    flex-direction: column;
}

/* ========== Header ========== */
.header {
    flex-shrink: 0;
    border-bottom: 2px solid var(--border-light);
    background: var(--card-bg);
    box-shadow: 0 2px 12px rgba(61, 52, 40, 0.04);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-heading);
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 3px 0 0 var(--primary-active);
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ========== Main Layout ========== */
.main-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    height: calc(100vh - 62px);
    overflow: hidden;
}

/* ========== Controls Panel ========== */
.left-panel {
    width: 440px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    overflow-y: auto;
    padding-right: 4px;
}

/* ========== History Sidebar ========== */
.history-sidebar {
    width: 240px;
    flex-shrink: 0;
    height: 100%;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.04);
}

.history-sidebar-header {
    padding: 12px 14px;
    border-bottom: 1.5px solid var(--border-light);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-sidebar-header .history-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-btn);
    font-size: 10px;
    font-weight: 700;
}

.history-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-sidebar-body .history-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    background: var(--bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.history-sidebar-body .history-item:hover {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 2px 6px rgba(25, 200, 185, 0.1);
}

.history-sidebar-body .history-item.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* 历史记录骨架屏加载 */
.history-skeleton {
    display: flex;
    align-items: center;
    padding: 7px 9px;
    background: var(--bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.history-skeleton .skeleton-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-skeleton .skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--border-light) 25%, #e8e2d0 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.6s ease-in-out infinite;
    border-radius: 4px;
}

.history-skeleton .skeleton-line.short {
    width: 50%;
}

@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

/* 移动端专属元素默认隐藏（桌面端不可见） */
.mobile-history-btn,
.mobile-bottom-bar,
.mobile-history-overlay,
.mobile-history-drawer {
    display: none;
}

.history-sidebar-body .history-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.history-sidebar-body .history-prompt {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
}

.history-sidebar-body .history-meta {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 历史记录缩略图（无结果图时展示占位图标） */
.history-sidebar-body .history-thumb,
.mobile-drawer-body .history-thumb {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fff;
    color: var(--text-muted);
}

.history-sidebar-body .history-thumb.is-empty,
.mobile-drawer-body .history-thumb.is-empty {
    background: var(--bg);
}

.history-sidebar-body .history-thumb img,
.mobile-drawer-body .history-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.history-sidebar-body .history-thumb svg,
.mobile-drawer-body .history-thumb svg {
    width: 20px;
    height: 20px;
    opacity: .45;
}

.history-sidebar-body .history-load-more {
    padding: 4px 0;
    text-align: center;
    flex-shrink: 0;
}

.history-sidebar-body .history-load-more button {
    padding: 5px 14px;
    background: var(--bg);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-btn);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.02em;
    transition: var(--transition);
}

.history-sidebar-body .history-load-more button:hover {
    background: var(--primary-light);
}

.history-sidebar-body .history-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 4px;
    padding: 16px 8px;
    text-align: center;
}

.history-sidebar-body .history-empty-icon {
    font-size: 28px;
    opacity: 0.6;
}

.history-sidebar-body .history-empty-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-card);
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.04);
    margin-bottom: 14px;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1.5px solid var(--border-light);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 18px 20px;
}

/* Prompt输入 */
.prompt-wrap {
    position: relative;
}

.prompt-wrap textarea {
    width: 100%;
    min-height: 240px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-card);
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    line-height: 1.7;
    color: var(--text);
    resize: vertical;
    transition: var(--transition);
    background: var(--bg);
    letter-spacing: 0.01em;
}

.prompt-wrap textarea::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.prompt-wrap textarea:focus {
    outline: none;
    border-color: var(--focus);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.15);
}

.prompt-wrap .char-count {
    position: absolute;
    bottom: 10px;
    right: 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

/* 参数行 */
.param-row {
    display: flex;
    gap: 12px;
}

.param-group {
    flex: 1;
}

.param-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.param-group select,
.param-group input {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 0.01em;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239f927d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 36px;
}

.param-group select:focus,
.param-group input:focus {
    outline: none;
    border-color: var(--focus);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.15);
}

/* 上传区域 */
.upload-zone {
    border: 2.5px dashed var(--border);
    border-radius: var(--radius-card);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    border-style: solid;
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    border-style: solid;
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-heading);
}

.upload-hint {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.upload-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* 参考图预览列表 */
.ref-preview-list {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ref-preview-item {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-light);
    flex-shrink: 0;
    transition: var(--transition);
}

.ref-preview-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 200, 185, 0.2);
}

.ref-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ref-preview-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: rgba(114, 93, 66, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.ref-preview-remove:hover {
    background: var(--danger);
    transform: scale(1.15);
}


/* ===== 当前模型标注 ===== */
.model-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    margin-bottom: 10px;
    background: rgba(25, 200, 185, 0.08);
    border: 1px dashed rgba(25, 200, 185, 0.4);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary, #5d4a32);
}
.model-indicator .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #19c8b9;
    box-shadow: 0 0 0 3px rgba(25, 200, 185, 0.18);
    flex-shrink: 0;
}
.model-indicator b {
    color: #12a396;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.01em;
}

/* ===== 按钮 ===== */

/* 主按钮 - 动森 3D 像素堆叠风格 */
.btn-generate {
    width: 100%;
    padding: 14px 0;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* 3D 像素堆叠阴影 */
    box-shadow: 0 5px 0 0 var(--primary-3d);
    transform: translateY(0);
    transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.12s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.btn-generate:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 0 0 var(--primary-3d);
    transform: translateY(-1px);
}

.btn-generate:active {
    box-shadow: 0 1px 0 0 var(--primary-3d);
    transform: translateY(4px);
    background: var(--primary-active);
}

.btn-generate:disabled {
    background: #a8e4df;
    box-shadow: 0 3px 0 0 #8ab8b5;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

.btn-generate:disabled:active {
    transform: none;
    box-shadow: 0 3px 0 0 #8ab8b5;
}

.btn-generate:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* 次要按钮 */
.btn-outline {
    padding: 8px 16px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.02em;
    transition: var(--transition);
    box-shadow: 0 2px 4px 0 var(--shadow-btn);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 3px 10px 0 var(--shadow-btn-hover);
    transform: translateY(-1px);
}

.btn-outline:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px 0 var(--shadow-btn);
}

/* spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

/* 叶子加载动画 */
.leaf-spinner {
    animation: leafBounce 0.6s ease-in-out infinite alternate;
}

@keyframes leafBounce {
    from { transform: translateY(0) rotate(0deg); }
    to { transform: translateY(-4px) rotate(5deg); }
}

/* ========== Right Panel ========== */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.result-card {
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-card);
    display: flex;
    flex-direction: column;
    min-height: 480px;
    flex: 1;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.04);
}

.result-card-header {
    padding: 14px 20px;
    border-bottom: 1.5px solid var(--border-light);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 10px;
    padding: 40px 20px;
}

.result-empty-icon {
    width: 60px;
    height: 60px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border: 2px dashed var(--border);
}

.result-empty-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
}

.result-empty-desc {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    max-width: 300px;
}

.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    align-content: start;
}

/* 注意：.result-content 是 flex 子项，交叉轴上的 auto margin 会吸走剩余空间、
   使宽度收缩到内容宽，必须先显式 width:100% 才能让 max-width 生效 */
.result-content.single-image,
.result-content.images-1 {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 1100px;    /* 放宽上限：单图尽量铺满结果区 */
    margin: 0 auto;
}

/* 单图：不套用 1:1 方框，宽度铺满结果区，高度按原图比例自然展开 */
.result-content.single-image .image-block,
.result-content.images-1 .image-block {
    aspect-ratio: auto;
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
    min-height: 220px;   /* 图片加载完成前占位，避免高度跳动 */
}

.result-content.single-image .image-preview-button,
.result-content.images-1 .image-preview-button {
    display: block;
    width: 100%;
    height: auto;
}

/* 单图必须 height:auto：img 的 height:100% 在父高不确定时会把图片压扁或留白 */
.result-content.single-image .image-preview-button img,
.result-content.images-1 .image-preview-button img {
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

/* 两张：左右并排 */
.result-content.images-2 {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
}

/* 四张：上二下二 */
.result-content.images-4 {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
}

/* 三张：上一（居中，与下排等宽）下二 */
.result-content.images-3 {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
}

.result-content.images-3 .image-block:first-child {
    grid-column: 1 / -1;
    width: calc(50% - 9px);   /* 减去 gap 的一半，与下排两张等宽 */
    justify-self: center;
}

.image-block {
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.05);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    aspect-ratio: 1 / 1;
}

.image-block:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(61, 52, 40, 0.12);
    border-color: var(--primary);
}

.image-block:hover .image-overlay {
    opacity: 1;
}

/* 预览按钮撑满整个格子，img 的 width:100% 才有参照（原先是无样式 button，会收缩到内容） */
.image-preview-button {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.image-block img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: var(--bg);
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(114, 93, 66, 0.75));
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transition: var(--transition);
}

.image-index {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

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

.image-action-btn {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 5px 14px;
    border-radius: var(--radius-btn);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    letter-spacing: 0.02em;
}

.image-action-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* ===== Loading 动森风格加载动画 ===== */
.result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px 20px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(25,200,185,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(247,205,103,0.05) 0%, transparent 50%);
}

/* -------- 浮动粒子 -------- */
.loading-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    font-size: 18px;
    opacity: 0;
    animation-fill-mode: both;
}

.p1 { top: 10%; left: 10%;  animation: floatUp 3.5s ease-in-out 0s infinite; font-size: 22px; }
.p2 { top: 25%; left: 75%;  animation: floatUp 2.8s ease-in-out 0.6s infinite; font-size: 16px; }
.p3 { top: 40%; left: 18%;  animation: floatUp 3.2s ease-in-out 1.2s infinite; font-size: 20px; }
.p4 { top: 15%; left: 55%;  animation: floatUp 3.0s ease-in-out 0.3s infinite; font-size: 14px; }
.p5 { top: 50%; left: 80%;  animation: floatUp 3.8s ease-in-out 0.9s infinite; font-size: 18px; }
.p6 { top: 35%; left: 88%;  animation: floatUp 3.4s ease-in-out 1.5s infinite; font-size: 15px; }

@keyframes floatUp {
    0%   { opacity: 0; transform: translateY(30px) rotate(0deg) scale(0.6); }
    15%  { opacity: 0.9; }
    50%  { opacity: 0.7; transform: translateY(-30px) rotate(15deg) scale(1.05); }
    85%  { opacity: 0.2; }
    100% { opacity: 0; transform: translateY(-80px) rotate(25deg) scale(0.4); }
}

/* -------- 主场景 -------- */
.loading-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 1;
}

/* 角色 + 阴影 */
.loading-character-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-character {
    font-size: 56px;
    animation: characterBounce 1.2s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(61,52,40,0.15));
    z-index: 1;
    cursor: default;
    user-select: none;
}

.loading-character-shadow {
    width: 40px;
    height: 10px;
    background: rgba(61, 52, 40, 0.12);
    border-radius: 50%;
    animation: shadowPulse 1.2s ease-in-out infinite;
}

@keyframes characterBounce {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    25%      { transform: translateY(-16px) rotate(0deg); }
    50%      { transform: translateY(-4px) rotate(3deg); }
    75%      { transform: translateY(-20px) rotate(-1deg); }
}

@keyframes shadowPulse {
    0%, 100% { transform: scaleX(1); opacity: 1; }
    25%      { transform: scaleX(0.7); opacity: 0.5; }
    50%      { transform: scaleX(0.9); opacity: 0.8; }
    75%      { transform: scaleX(0.6); opacity: 0.4; }
}

/* 旋转文案 */
.result-loading .loading-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
    text-align: center;
    min-height: 24px;
    position: relative;
    transition: opacity 0.4s ease;
}

.result-loading .loading-subtext {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    min-height: 18px;
    transition: opacity 0.4s ease;
}

/* -------- 进度条 -------- */
.loading-progress-wrap {
    margin-top: 20px;
    width: 100%;
    max-width: 300px;
    z-index: 1;
}

.loading-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: var(--radius-btn);
    overflow: hidden;
    border: 1.5px solid var(--border);
}

.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #5fe0d4, var(--primary-hover));
    background-size: 200% 100%;
    border-radius: var(--radius-btn);
    animation: progressShine 1.8s ease-in-out infinite,
               progressGrow 12s cubic-bezier(0.2, 0.6, 0.5, 1) forwards;
    transition: width 0.3s ease;
}

@keyframes progressShine {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes progressGrow {
    0%   { width: 0%; }
    20%  { width: 18%; }
    40%  { width: 40%; }
    60%  { width: 58%; }
    75%  { width: 72%; }
    85%  { width: 83%; }
    92%  { width: 90%; }
    100% { width: 95%; }
}

/* 进度点 */
.loading-progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--border);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.loading-dot.active {
    background: var(--primary);
    box-shadow: 0 0 8px rgba(25,200,185,0.4);
    animation: dotPulse 0.8s ease-in-out infinite;
}

.loading-dot:nth-child(1) { animation-delay: 0s; }
.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.6); opacity: 0.6; }
}

/* 消息提示 */
.toast {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    border: 2px solid;
}

.toast-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.toast-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

/* 浮动通知 */
.toast-float {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    border-radius: var(--radius-btn);
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
    pointer-events: none;
    animation: toastIn .3s cubic-bezier(0.4, 0, 0.2, 1),
               toastOut .3s cubic-bezier(0.4, 0, 0.2, 1) 2.7s forwards;
    box-shadow: 0 4px 16px rgba(61, 52, 40, 0.12);
    border: 2px solid;
    letter-spacing: 0.01em;
}

.toast-float.toast-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.toast-float.toast-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.toast-float.toast-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to   { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}



/* ===== 历史详情弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(61, 52, 40, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-dialog {
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 620px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(61, 52, 40, 0.15);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-family: inherit;
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

/* ===== 绑定手机号 ===== */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bind-phone-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-btn);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.bind-phone-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.bind-phone-btn.bound {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-active);
}

.bind-intro {
    background: var(--primary-light);
    border: 1.5px dashed var(--primary);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.75;
    color: var(--text);
    margin-bottom: 16px;
}

.bind-err {
    background: var(--danger-bg);
    border: 1.5px solid var(--danger);
    border-radius: var(--radius-xs);
    padding: 9px 12px;
    font-size: 13px;
    color: var(--danger-active);
    margin-bottom: 14px;
}

.bind-form label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
    margin: 14px 0 6px;
}

.bind-form label:first-child { margin-top: 0; }

.bind-form input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-xs);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.bind-form input:focus {
    border-color: var(--primary);
    background: #fff;
}

.bind-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
    line-height: 1.65;
}

.bind-submit {
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    font-size: 14px;
}

.bind-submit:disabled { opacity: .6; cursor: not-allowed; }

.bind-done { text-align: center; padding: 8px 0 4px; }
.bind-done-icon { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.bind-done-title { font-size: 16px; font-weight: 800; color: var(--text-heading); }
.bind-done-text { font-size: 13px; line-height: 1.8; color: var(--text-secondary); margin-top: 10px; }

@media (max-width: 768px) {
    .bind-phone-btn { padding: 6px 10px; font-size: 12px; gap: 4px; }
}

.modal-section {
    margin-bottom: 18px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.modal-prompt {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-params {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-param-tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-btn);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.modal-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-image-item {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1.5px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}

.modal-image-item:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

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

.modal-image-item.result-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.modal-image-item.result-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 400px;
    background: var(--bg);
}

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

.modal-action-btn {
    padding: 8px 18px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.02em;
    transition: var(--transition);
    box-shadow: 0 3px 0 0 var(--primary-3d);
}

.modal-action-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 0 0 var(--primary-3d);
    transform: translateY(-1px);
}

.modal-action-btn:active {
    box-shadow: 0 1px 0 0 var(--primary-3d);
    transform: translateY(2px);
}

.modal-action-btn.secondary {
    background: var(--bg);
    color: var(--text-heading);
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 4px var(--shadow-btn);
}

.modal-action-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 3px 10px var(--shadow-btn-hover);
}

/* ===== 全屏图片查看 ===== */
.image-viewer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-viewer-overlay.show {
    display: flex;
}

.image-viewer-overlay img {
    max-width: 95vw;
    max-height: 95vh;
    border-radius: var(--radius-sm);
    animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}



/* ========== 响应式 ========== */

/* Large tablet / small desktop */
@media (max-width: 1300px) {
    .left-panel {
        width: 380px;
    }
    .history-sidebar {
        width: 220px;
    }
    .result-content {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 14px;
        padding: 14px;
    }
}

/* Tablet: 历史侧边栏收起 */
@media (max-width: 1060px) {
    .history-sidebar {
        display: none;
    }
    .left-panel {
        width: 400px;
    }
}

/* Narrow / 移动端 ChatGPT 风格上下布局 */
@media (max-width: 768px) {
    .header-inner {
        padding: 10px 16px;
    }

    .logo-text {
        font-size: 14px;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
        border-radius: 10px;
    }

    .main-container {
        flex-direction: column;
        padding: 0;
        gap: 0;
        height: calc(100vh - 44px);
        overflow: hidden;
    }

    .history-sidebar {
        display: none;
    }

    .left-panel {
        display: none;
    }

    /* 右侧结果区域占满剩余空间 */
    .right-panel {
        flex: 1;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .result-card {
        min-height: 0;
        height: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
        background: var(--bg);
    }

    .result-card-header {
        padding: 10px 16px;
        font-size: 13px;
        background: var(--card-bg);
        border-bottom: 1.5px solid var(--border-light);
    }

    .result-content {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
        padding-bottom: 68px;
        justify-items: stretch;
        justify-content: stretch;
    }

    .result-content.single-image,
    .result-content.images-1 {
        max-width: 100%;
        margin: 0 auto;
    }

    /* 移动端一律单列，放弃桌面端的按张数排布 */
    .result-content.images-2,
    .result-content.images-3,
    .result-content.images-4 {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .result-content.images-3 .image-block:first-child {
        grid-column: auto;
        width: 100%;
    }

    .result-empty {
        padding: 40px 20px 68px;
    }

    .result-empty-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .result-empty-title {
        font-size: 14px;
    }

    .result-empty-desc {
        font-size: 12px;
    }

    .image-block {
        border-radius: var(--radius-sm);
        aspect-ratio: auto;
        width: 100%;
        background: var(--bg);
    }

    .image-block img {
        display: block;
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    /* 移动端 overlay 始终可见（无法 hover） */
    .image-overlay {
        opacity: 1;
        padding: 8px 12px;
    }

    .image-index {
        font-size: 11px;
    }

    .image-actions {
        gap: 4px;
    }

    .image-action-btn {
        font-size: 11px;
        padding: 4px 12px;
    }

    /* 加载动画移动端适配 */
    .loading-character {
        font-size: 46px;
    }
    .loading-character-shadow {
        width: 32px;
        height: 8px;
    }
    .result-loading .loading-text {
        font-size: 14px;
    }
    .particle {
        font-size: 14px !important;
    }
    .p1 { font-size: 18px !important; }
    .p3 { font-size: 16px !important; }
    .loading-progress-wrap {
        max-width: 240px;
    }

    /* ===== 移动端顶部: 历史记录按钮 ===== */
    .mobile-history-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: 1.5px solid var(--border-light);
        border-radius: var(--radius-btn);
        background: var(--bg);
        color: var(--text);
        cursor: pointer;
        position: relative;
        transition: var(--transition);
        font-family: inherit;
    }

    .mobile-history-btn:hover {
        border-color: var(--primary);
        background: var(--primary-light);
    }

    .mobile-history-btn:active {
        transform: scale(0.95);
    }

    .mobile-history-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        background: var(--primary);
        color: #fff;
        border-radius: var(--radius-btn);
        font-size: 9px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    /* ===== 移动端底部操作栏 ===== */
    .mobile-bottom-bar {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: var(--card-bg);
        border-top: 2px solid var(--border-light);
        box-shadow: 0 -2px 12px rgba(61, 52, 40, 0.08);
    }

    .mobile-toolbar {
        padding: 8px 12px 4px;
        border-bottom: 1px solid var(--border-light);
        animation: slideDown 0.2s ease;
    }

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

    .mobile-toolbar-row {
        display: flex;
        gap: 6px;
        align-items: center;
        margin-bottom: 6px;
    }

    .mobile-select {
        flex: 1;
        padding: 7px 10px;
        border: 1.5px solid var(--border);
        border-radius: var(--radius-btn);
        font-size: 12px;
        font-family: inherit;
        font-weight: 500;
        color: var(--text);
        background: var(--bg);
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239f927d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
        padding-right: 24px;
    }

    .mobile-select:focus {
        outline: none;
        border-color: var(--focus);
    }

    .mobile-ref-btn {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        border: 1.5px dashed var(--border);
        border-radius: var(--radius-btn);
        background: var(--bg);
        color: var(--text-secondary);
        font-size: 11px;
        font-family: inherit;
        cursor: pointer;
        transition: var(--transition);
        white-space: nowrap;
    }

    .mobile-ref-btn:active {
        border-color: var(--primary);
        color: var(--primary);
        background: var(--primary-light);
    }

    .mobile-ref-previews {
        display: flex;
        gap: 4px;
        overflow-x: auto;
        flex: 1;
    }

    .mobile-ref-previews .mini-ref {
        width: 28px;
        height: 28px;
        border-radius: 4px;
        overflow: hidden;
        border: 1px solid var(--border-light);
        flex-shrink: 0;
        position: relative;
    }

    .mobile-ref-previews .mini-ref img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .mobile-ref-previews .mini-ref .mini-ref-remove {
        position: absolute;
        top: -2px;
        right: -2px;
        width: 14px;
        height: 14px;
        background: rgba(114, 93, 66, 0.7);
        color: #fff;
        border: none;
        border-radius: 50%;
        font-size: 9px;
        line-height: 14px;
        text-align: center;
        cursor: pointer;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-input-row {
        display: flex;
        align-items: flex-end;
        gap: 8px;
        padding: 8px 12px 12px;
    }

    .mobile-tool-toggle {
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        border: 1.5px solid var(--border);
        border-radius: var(--radius-btn);
        background: var(--bg);
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--transition);
        font-family: inherit;
    }

    .mobile-tool-toggle:active {
        background: var(--primary-light);
        color: var(--primary);
        border-color: var(--primary);
    }

    .mobile-tool-toggle.active {
        background: var(--primary-light);
        color: var(--primary);
        border-color: var(--primary);
    }

    .mobile-prompt-input {
        flex: 1;
        padding: 9px 14px;
        border: 1.5px solid var(--border);
        border-radius: var(--radius-btn);
        font-size: 14px;
        font-family: inherit;
        font-weight: 500;
        color: var(--text);
        background: var(--bg);
        resize: none;
        max-height: 100px;
        line-height: 1.5;
        overflow-y: auto;
        transition: var(--transition);
    }

    .mobile-prompt-input::placeholder {
        color: var(--text-muted);
        font-weight: 400;
    }

    .mobile-prompt-input:focus {
        outline: none;
        border-color: var(--focus);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.12);
    }

    .mobile-send-btn {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 50%;
        background: var(--primary);
        color: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 3px 0 0 var(--primary-3d);
        transition: var(--transition);
        font-family: inherit;
    }

    .mobile-send-btn:active {
        box-shadow: 0 1px 0 0 var(--primary-3d);
        transform: translateY(2px);
    }

    .mobile-send-btn:disabled {
        background: #a8e4df;
        box-shadow: 0 2px 0 0 #8ab8b5;
        transform: none;
    }

    /* ===== 移动端历史记录抽屉 ===== */
    .mobile-history-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(61, 52, 40, 0.35);
        backdrop-filter: blur(4px);
        z-index: 200;
    }

    .mobile-history-overlay.show {
        display: block;
    }

    .mobile-history-drawer {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 201;
        background: var(--card-bg);
        border-radius: var(--radius-card) var(--radius-card) 0 0;
        max-height: 70vh;
        box-shadow: 0 -8px 30px rgba(61, 52, 40, 0.15);
        animation: drawerUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-direction: column;
    }

    .mobile-history-drawer.show {
        display: flex;
    }

    @keyframes drawerUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .mobile-drawer-header {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 14px 16px 10px;
        border-bottom: 1.5px solid var(--border-light);
        flex-shrink: 0;
        font-size: 14px;
        font-weight: 700;
        color: var(--text-heading);
    }

    .mobile-drawer-count {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
    }

    .mobile-drawer-close {
        margin-left: auto;
        width: 28px;
        height: 28px;
        border: none;
        background: var(--bg);
        border-radius: 50%;
        font-size: 18px;
        cursor: pointer;
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: inherit;
        transition: var(--transition);
    }

    .mobile-drawer-close:active {
        background: var(--danger-bg);
        color: var(--danger);
    }

    .mobile-drawer-body {
        flex: 1;
        overflow-y: auto;
        padding: 8px 12px 20px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-drawer-body .history-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        background: var(--bg);
        border: 1.5px solid var(--border-light);
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition: var(--transition);
        flex-shrink: 0;
    }

    .mobile-drawer-body .history-item:active {
        border-color: var(--primary);
        background: var(--primary-light);
    }

    .mobile-drawer-body .history-info {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .mobile-drawer-body .history-prompt {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-heading);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 2px;
    }

    .mobile-drawer-body .history-meta {
        font-size: 11px;
        font-weight: 500;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-drawer-body .history-empty {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        gap: 4px;
        padding: 30px 8px;
        text-align: center;
    }

    .mobile-drawer-body .history-empty-icon {
        font-size: 28px;
        opacity: 0.6;
    }

    .mobile-drawer-body .history-empty-text {
        font-size: 12px;
        font-weight: 500;
        color: var(--text-secondary);
    }

    .mobile-drawer-body .history-skeleton {
        display: flex;
        align-items: center;
        padding: 10px 12px;
        background: var(--bg);
        border: 1.5px solid var(--border-light);
        border-radius: var(--radius-sm);
        flex-shrink: 0;
    }

    .mobile-drawer-body .history-skeleton .skeleton-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .mobile-drawer-body .history-skeleton .skeleton-line {
        height: 12px;
        background: linear-gradient(90deg, var(--border-light) 25%, #e8e2d0 50%, var(--border-light) 75%);
        background-size: 200% 100%;
        animation: skeletonShimmer 1.6s ease-in-out infinite;
        border-radius: 4px;
    }

    .mobile-drawer-body .history-skeleton .skeleton-line.short {
        width: 50%;
    }

    /* 弹窗移动端适配 */
    .modal-dialog {
        max-width: 100%;
        margin: 0 8px;
        max-height: 90vh;
    }
    .modal-body {
        padding: 14px;
    }
    .modal-header {
        padding: 12px 16px;
    }
    .modal-prompt {
        font-size: 13px;
        padding: 10px 12px;
    }

    /* toast */
    .toast {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* Mobile: 小屏设备微调 */
@media (max-width: 640px) {
    .mobile-input-row {
        padding: 6px 10px 10px;
        gap: 6px;
    }

    .mobile-send-btn {
        width: 36px;
        height: 36px;
    }

    .mobile-tool-toggle {
        width: 34px;
        height: 34px;
    }

    .mobile-prompt-input {
        font-size: 14px;
        padding: 8px 12px;
    }

    .mobile-toolbar {
        padding: 6px 10px 2px;
    }

    .mobile-select {
        font-size: 11px;
        padding: 6px 8px;
        padding-right: 22px;
    }

    .mobile-history-drawer {
        max-height: 75vh;
    }
}

/* Small mobile */
@media (max-width: 400px) {
    .mobile-input-row {
        padding: 5px 8px 8px;
    }

    .mobile-history-drawer {
        max-height: 80vh;
    }

    .result-content {
        gap: 8px;
        padding: 8px;
    }
}

/* ========== 应用主体：左侧栏（菜单+历史） + 右侧主区 ========== */
.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---------- 左侧栏 ---------- */
.app-sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--card-bg);
    border-right: 2px solid var(--border-light);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    flex-shrink: 0;
}

.sidebar-menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-menu-item svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* 选中态用浅色卡片 + 左侧指示条，避免与青绿生成按钮撞色 */
.sidebar-menu-item.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.10);
}

.sidebar-menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-menu-item.active svg {
    opacity: 1;
}

.sidebar-menu-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-btn);
    font-size: 10px;
    font-weight: 800;
}

.sidebar-menu-item.active .sidebar-menu-badge {
    background: var(--primary);
    color: #fff;
}

/* 侧栏内的历史记录：融入侧栏，不再是独立卡片 */
.app-sidebar .history-sidebar {
    display: flex;
    width: auto;
    height: auto;
    flex: 1;
    min-height: 0;
    border: none;
    border-radius: 0;
    border-top: 1.5px solid var(--border-light);
    box-shadow: none;
    background: transparent;
}

.app-sidebar .history-sidebar-header {
    padding: 12px 16px 10px;
    border-bottom: none;
    color: var(--text-secondary);
    font-size: 12px;
}

.app-sidebar .history-sidebar-body {
    padding: 0 10px 12px;
}

/* ---------- 右侧主区 ---------- */
.app-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-main .main-container {
    max-width: none;
    margin: 0;
    height: 100%;
    padding: 14px;
}

/* 高度链路：主区 → 视图 → 容器 → 左右两栏，必须逐层 100% 才能撑满视口 */
.app-main .module-view.is-active {
    height: 100%;
}

.app-main .right-panel {
    height: 100%;
}

/* 右栏已有确定高度，去掉固定最小高度，避免矮视口下溢出被裁 */
.app-main .result-card {
    min-height: 0;
}

/* ---------- 顶栏模型标识 ---------- */
.header-model {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-btn);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.header-model .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(111, 186, 44, 0.16);
}

.header-model b {
    color: var(--text-heading);
}

/* ---------- 卡片标题右侧操作按钮 ---------- */
.card-header-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    padding: 4px 11px;
    border: none;
    background: var(--primary-light);
    color: var(--primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.card-header-action:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.card-header-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------- 选项按钮组（比例 / 数量） ---------- */
.opt-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.opt-btn {
    min-width: 46px;
    padding: 6px 8px;
    border: 1.5px solid var(--border-light);
    background: var(--bg);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.opt-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.opt-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 0 0 var(--primary-3d);
}

.opt-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 数量按钮更紧凑，保证与分辨率并排时一行放得下 */
.opt-grid-compact .opt-btn {
    min-width: 38px;
    padding: 6px 6px;
}

/* 原生下拉退居幕后，仅作为数据源，界面用按钮组呈现 */
.select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* ---------- 结果区头部 ---------- */
.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.result-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.result-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
}

.result-header-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.view-toggle {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    background: var(--bg);
    border-radius: var(--radius-btn);
    flex-shrink: 0;
}

.view-toggle-btn {
    padding: 5px 13px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: var(--transition);
}

.view-toggle-btn:hover {
    color: var(--primary);
}

.view-toggle-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(61, 52, 40, 0.12);
}

.result-content.list-view {
    grid-template-columns: 1fr;
    justify-items: center;
}

.result-content.list-view .image-block {
    width: 100%;
    max-width: 760px;
    aspect-ratio: auto;
}

/* ---------- 空状态三步引导 ---------- */
.empty-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 580px;
    margin-top: 20px;
}

.empty-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 16px 12px;
    background: var(--card-bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    text-align: center;
}

.empty-step-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 11px;
}

.empty-step-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-heading);
}

.empty-step-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 视图容器 */
.module-view {
    display: none;
}

.module-view.is-active {
    display: block;
}

/* ========== 灵感模板模块 ========== */
#tplView {
    height: 100%;
    padding: 18px 22px 40px;
    overflow-y: auto;
}

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

.tpl-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-heading);
}

.tpl-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.tpl-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0 18px;
}

.tpl-chip {
    padding: 6px 15px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-btn);
    background: #fff;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tpl-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tpl-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.tpl-loading {
    grid-column: 1 / -1;
    padding: 60px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.tpl-card {
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.05);
    transition: var(--transition);
}

.tpl-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 26px rgba(61, 52, 40, 0.14);
}

.tpl-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--ds-surface-muted);
    cursor: pointer;
}

/* contain：示例图完整展示不裁切；非 4:3 的图会留白，用底色填充 */
.tpl-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.tpl-card:hover .tpl-cover img {
    transform: scale(1.02);
}

.tpl-cover .tpl-refbadge {
    position: absolute;
    left: 10px;
    top: 10px;
    background: rgba(255, 204, 0, 0.92);
    color: #6b4b00;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.tpl-cover .tpl-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
}

.tpl-cover .tpl-noimg {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--text-muted);
}

.tpl-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex: 1;
}

.tpl-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-heading);
}

.tpl-prompt {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpl-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tpl-tag {
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.tpl-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
}

.tpl-btn {
    flex: 1;
    padding: 8px 10px;
    border-radius: var(--radius-btn);
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.tpl-btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 0 0 var(--primary-3d);
}

.tpl-btn-primary:hover {
    background: var(--primary-hover);
}

.tpl-btn-primary:active {
    transform: translateY(1px);
    box-shadow: none;
}

.tpl-btn-ghost {
    flex: 0 0 auto;
    background: #fff;
    border: 1.5px solid var(--border-light);
    color: var(--text-secondary);
    padding: 8px 14px;
}

.tpl-btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tpl-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
}

.tpl-state .icon {
    font-size: 46px;
    margin-bottom: 10px;
}

/* ========== 历史详情弹窗：复用模板详情的「左图右信息」布局 ========== */
#detailModal .modal-dialog {
    max-width: 980px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line-strong);
}

#detailModal .modal-header {
    background: var(--ds-surface);
    border-bottom-color: var(--ds-line);
}

/* 无结果（失败 / 排队中）时左栏占位，避免整栏塌陷 */
.detail-empty-media {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 220px;
    padding: 20px;
    text-align: center;
    background: var(--ds-surface-muted);
    border: 1.5px dashed var(--ds-line-strong);
    border-radius: 12px;
    color: var(--ds-muted);
    font-size: 13px;
    line-height: 1.8;
    word-break: break-word;
}

.detail-media-extra {
    margin-top: 14px;
    min-width: 0;
}

/* 参考图较多时（最多 16 张）限制高度，避免把左栏拉得过长 */
.detail-media-extra .modal-images {
    max-height: 200px;
    overflow-y: auto;
}

.detail-media-extra .modal-image-item {
    width: 64px;
    height: 64px;
}

.detail-meta {
    font-size: 12px;
    color: var(--ds-muted);
    line-height: 1.7;
}

/* 用量信息：有最大高度，超出在框内滚动 */
.detail-usage {
    margin: 0;
    background: var(--ds-surface-muted);
    border: 1px solid var(--ds-line-strong);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ds-ink-soft);
    max-height: 140px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========== 模板详情弹窗：左侧示例图 + 右侧信息 ========== */
#tplDetailModal .modal-dialog {
    max-width: 980px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line-strong);
}

#tplDetailModal .modal-header {
    background: var(--ds-surface);
    border-bottom-color: var(--ds-line);
}

.tpl-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.tpl-detail-media,
.tpl-detail-info {
    min-width: 0;
}

.tpl-detail-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

/* 多张示例图：方形格子内完整展示（不裁切）；max-width 兜底，
   保证任何情况下图片都不会横向溢出到右侧信息栏 */
.tpl-detail-gallery img {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--ds-surface-muted);
    border: 1px solid var(--ds-line-strong);
    border-radius: 12px;
    cursor: zoom-in;
    transition: border-color var(--ds-ease), transform var(--ds-ease), box-shadow var(--ds-ease);
}

/* 只有一张示例图：铺满整列、按原图比例完整展示，
   仅限制最大高度，避免竖版长图把弹窗撑得过高 */
.tpl-detail-gallery img:only-child {
    grid-column: 1 / -1;
    justify-self: center;
    width: auto;
    height: auto;
    aspect-ratio: auto;
    max-height: min(64vh, 560px);
}

.tpl-detail-gallery img:hover {
    border-color: var(--ds-primary);
    box-shadow: var(--ds-shadow-sm);
    transform: translateY(-2px);
}

.tpl-detail-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--ds-muted);
    margin-bottom: 8px;
}

.tpl-detail-prompt {
    background: var(--ds-surface-muted);
    border: 1px solid var(--ds-line-strong);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--ds-ink-soft);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow-y: auto;
}

.tpl-detail-params {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tpl-detail-apply {
    padding: 12px;
}

.tpl-ref-notice {
    background: var(--warning-bg);
    border: 1.5px dashed var(--warning);
    color: #8a6100;
    font-size: 12.5px;
    line-height: 1.6;
    padding: 10px 12px;
    border-radius: 12px;
}

.tpl-param-pill {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--ds-surface-muted);
    border: 1px solid var(--ds-line-strong);
    color: var(--ds-ink-soft);
    font-weight: 600;
}

/* 模板视图下隐藏移动端底部操作栏 */
body.tpl-mode .mobile-bottom-bar {
    display: none !important;
}

/* 套用模板后高亮参数面板 */
.left-panel.tpl-applied .card,
.left-panel.tpl-applied .btn-generate {
    animation: tplPulse 1.6s ease;
}

@keyframes tplPulse {
    0%   { box-shadow: 0 0 0 0 rgba(25, 200, 185, 0.55); }
    70%  { box-shadow: 0 0 0 10px rgba(25, 200, 185, 0); }
    100% { box-shadow: 0 0 0 0 rgba(25, 200, 185, 0); }
}

/* 中小屏：侧栏随之收窄，为结果区留出空间 */
@media (max-width: 1060px) {
    .app-sidebar {
        width: 212px;
    }
}

@media (max-width: 768px) {
    /* 移动端：侧栏简化为顶栏下方的横向菜单，历史继续走原有抽屉 */
    .header-model {
        display: none;
    }

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

    .opt-btn {
        min-width: 50px;
        padding: 6px 9px;
        font-size: 12px;
    }

    .app-body {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        flex-shrink: 0;
        border-right: none;
        border-bottom: 2px solid var(--border-light);
        padding: 6px 10px;
    }

    .sidebar-menu {
        flex-direction: row;
        gap: 6px;
        width: 100%;
        padding: 0;
        overflow-x: auto;
    }

    .sidebar-menu-item {
        width: auto;
        padding: 7px 14px;
        font-size: 13px;
        border-radius: var(--radius-btn);
        white-space: nowrap;
    }

    .app-sidebar .history-sidebar {
        display: none;
    }

    .app-main {
        flex: 1;
        min-height: 0;
    }

    .app-main .main-container {
        height: 100%;
        padding: 0;
    }

    #tplView {
        height: 100%;
        padding: 14px 14px 90px;
    }

    .tpl-title {
        font-size: 17px;
    }

    .tpl-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    /* 模板详情：窄屏改为上图下信息 */
    .tpl-detail {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}
