/**
 * 模特换装工作台 - 圆润现代风格
 * Soft & Rounded Modern Design
 */

/* === 基础变量 === */
:root {
    /* 颜色系统 - 更柔和 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-canvas: linear-gradient(135deg, #e0e7ef 0%, #d1dbe8 100%);

    --border-primary: rgba(0, 0, 0, 0.06);
    --border-secondary: rgba(0, 0, 0, 0.08);
    --border-focus: #6366f1;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;

    /* 主题色 - 专业蓝 */
    --accent-primary: #2563eb;
    --accent-secondary: #3b82f6;
    --accent-light: #eff6ff;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --accent-gradient-hover: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);

    /* 语义色 */
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* 阴影系统 - 精细分级 */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.06), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.05);
    --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.1), 0 12px 24px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 4px 24px rgba(37, 99, 235, 0.35);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.04);

    /* 圆角系统 */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-2xl: 36px;
    --radius-full: 9999px;

    /* 间距系统 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* 过渡动画 */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* 尺寸 */
    --nav-height: 64px;
    --sidebar-width: 380px;
}

/* === 重置与基础 === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-canvas);
    height: 100vh;
    height: 100dvh; /* 动态视口高度，考虑任务栏 */
    overflow: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

img {
    max-width: 100%;
    display: block;
}

/* === 顶部导航栏 === */
.top-nav {
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
}

.brand-icon {
    font-size: 24px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition-normal);
    text-decoration: none;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.icon-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-md);
}

.nav-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: var(--transition-fast);
}

.nav-btn:hover svg {
    opacity: 1;
}

/* === 主布局 === */
.app-layout {
    display: flex;
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height)); /* 动态视口高度 */
    margin-top: var(--nav-height);
    position: relative;
    z-index: 1;
}

/* === 侧边栏 === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.03);
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sidebar-inner {
    width: var(--sidebar-width);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    padding: 20px 24px;
}

.sidebar-section:first-child {
    padding-top: 16px;
}

/* === 上传卡片 - 圆润设计 === */
.upload-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-inset);
}

.upload-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* === 上传槽位 - 默认1:1正方形（服装图） === */
.upload-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 2px dashed var(--border-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-normal);
    overflow: hidden;
    background: var(--bg-primary);
}

/* === 模特图上传区域 - 9:16竖屏 === */
#modelUpload {
    aspect-ratio: 9 / 16;
}

/* === 服装图上传区域 - 1:1正方形（使用primary样式） === */
#clothingUpload {
    aspect-ratio: 1 / 1;
}

.upload-slot:hover {
    border-color: var(--accent-secondary);
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-slot.primary {
    border-color: var(--accent-primary);
    border-style: dashed;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, rgba(59, 130, 246, 0.03) 100%);
}

.upload-slot.primary:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
}

.slot-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-tertiary);
    transition: var(--transition-normal);
    padding: 20px;
    text-align: center;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    opacity: 0.8;
    transition: var(--transition-normal);
}

.upload-slot:hover .placeholder-icon {
    opacity: 1;
    background: var(--accent-light);
    color: var(--accent-primary);
    transform: scale(1.05);
}

.upload-slot:hover .slot-placeholder {
    color: var(--accent-primary);
}

.placeholder-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.placeholder-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

.slot-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: var(--transition-normal);
    border-radius: calc(var(--radius-lg) - 2px);
}

.upload-slot.has-file .slot-preview {
    opacity: 1;
}

.upload-slot.has-file .slot-placeholder {
    display: none;
}

.upload-slot.has-file {
    border-style: solid;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

.upload-slot.has-file:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 拖拽状态 */
.upload-slot.dragging {
    border-color: var(--accent-primary);
    border-style: solid;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    transform: scale(1.02);
    box-shadow: 0 0 0 4px var(--accent-light), var(--shadow-lg);
}

.upload-slot.dragging .placeholder-icon {
    transform: scale(1.1);
    background: var(--accent-light);
    color: var(--accent-primary);
}

.upload-slot.dragging .slot-placeholder {
    color: var(--accent-primary);
}

/* === 角标样式 - 左上角 === */
.slot-label {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
    z-index: 1;
}

.label-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.label-dot.product {
    background: var(--accent-primary);
}

.label-dot.reference {
    background: var(--success);
}

/* === AI分析按钮 === */
.ai-analyze-btn {
    position: relative;
    width: 100%;
    margin-top: 16px;
    padding: 14px 20px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    color: var(--text-inverse);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-normal);
    overflow: hidden;
}

.ai-analyze-btn:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

.btn-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: translateX(-100%);
    animation: shimmer 2.5s infinite;
}

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

/* === 提示词区 === */
.prompt-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.prompt-select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-normal);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%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: 44px;
}

.prompt-select:hover {
    border-color: var(--border-secondary);
}

.prompt-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.prompt-input {
    width: 100%;
    min-height: 140px;
    padding: 16px 18px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    transition: var(--transition-normal);
}

.prompt-input::placeholder {
    color: var(--text-tertiary);
}

.prompt-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-light);
}

/* === 生成按钮区 === */
.sidebar-footer {
    margin-top: auto;
    padding: 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
}

.generate-btn {
    width: 100%;
    padding: 18px 24px;
    background: var(--text-primary);
    border-radius: var(--radius-lg);
    color: var(--text-inverse);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    background: #0f172a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

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

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* === 画布区域 === */
.canvas-main {
    flex: 1;
    background: var(--bg-canvas);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-y: auto; /* 允许垂直滚动 */
    overflow-x: hidden;
}

/* === 空状态 - 简约高级风格 === */
.canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    min-height: 400px;
    /* 让空状态在画布中垂直居中 */
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height)); /* dvh 渐进增强 */
}

/* 核心视觉区 */
.empty-visual {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 40px;
}

/* 呼吸光环 */
.glow-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.2);
    animation: glow-breathe 3s ease-in-out infinite;
}

.glow-ring.delay {
    inset: -24px;
    border-width: 1px;
    border-color: rgba(37, 99, 235, 0.1);
    animation-delay: 1.5s;
}

@keyframes glow-breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
        box-shadow: 0 0 60px 0 rgba(37, 99, 235, 0.2);
    }
}

/* 旋转轨道 */
.orbit-ring {
    position: absolute;
    inset: 24px;
    border-radius: 50%;
    border: 1px dashed rgba(37, 99, 235, 0.25);
    animation: orbit-rotate 12s linear infinite;
}

.orbit-dot {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 50%;
    box-shadow:
        0 0 16px var(--accent-primary),
        0 0 32px rgba(37, 99, 235, 0.5),
        0 0 48px rgba(37, 99, 235, 0.3);
}

@keyframes orbit-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 中心图标 */
.center-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 24px;
    color: var(--accent-primary);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(37, 99, 235, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    animation: icon-float 4s ease-in-out infinite;
}

.center-icon svg {
    filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.2));
}

@keyframes icon-float {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0);
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.08),
            0 0 0 1px rgba(37, 99, 235, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 1);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-10px);
        box-shadow:
            0 16px 48px rgba(0, 0, 0, 0.12),
            0 0 0 1px rgba(37, 99, 235, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 1);
    }
}

/* 标题 */
.empty-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

/* 描述 */
.empty-desc {
    font-size: 14px;
    color: var(--text-tertiary);
    margin: 0;
}

/* === 四宫格结果 === */
.result-container {
    width: 100%;
    /* 使用明确的高度计算 */
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height)); /* dvh 作为渐进增强 */
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* === 结果展示网格 - 9:16竖屏布局 === */
.result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 100%;
    width: auto;
    /* 限制网格最大高度 */
    max-height: calc(100vh - var(--nav-height) - 100px);
    max-height: calc(100dvh - var(--nav-height) - 100px); /* dvh 作为渐进增强 */
}

.result-item {
    position: relative;
    aspect-ratio: 9 / 16;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    cursor: pointer;
    /* 限制最大高度，让图片在视口内完整显示 */
    max-height: calc(100vh - var(--nav-height) - 100px);
    max-height: calc(100dvh - var(--nav-height) - 100px); /* dvh 作为渐进增强 */
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.result-item.selected {
    box-shadow: 0 0 0 3px var(--accent-primary), var(--shadow-xl);
}

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

/* 图片包装器 */
.item-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.item-overlay {
    display: none;
}

/* 序号角标 - 科技风 */
.item-index {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md), 0 0 15px rgba(37, 99, 235, 0.1);
    z-index: 2;
    border: 1px solid rgba(37, 99, 235, 0.1);
}

/* hover操作按钮 */
.item-actions {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition-normal);
    z-index: 2;
}

.result-item:hover .item-actions {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
}

.action-btn:hover {
    background: var(--bg-primary);
    color: var(--accent-primary);
    transform: scale(1.1);
}

/* === 微调模式覆盖层（全新设计） === */
.refine-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.refine-overlay.active {
    opacity: 1;
    visibility: visible;
}

.refine-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 680px;
    width: 100%;
    padding: 32px;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.refine-overlay.active .refine-container {
    transform: scale(1) translateY(0);
}

/* 关闭按钮 */
.refine-close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.refine-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.1);
}

/* 主图展示 - 9:16竖屏 */
.refine-main-image {
    position: relative;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 9 / 16;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

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

/* 缩略图选择区 - 9:16竖屏缩略图 */
.refine-thumbnails {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.refine-thumb-item {
    width: 45px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    opacity: 0.6;
    transition: all 0.3s ease;
    position: relative;
}

.refine-thumb-item:hover {
    opacity: 0.9;
    transform: translateY(-4px);
}

.refine-thumb-item.active {
    border-color: var(--accent-primary);
    opacity: 1;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
}

.refine-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.refine-thumb-item .thumb-num {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

/* 微调输入卡片 */
.refine-input-card {
    width: 100%;
    max-width: 560px;
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.input-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.input-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.input-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.input-wrapper input {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 16px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

.refine-send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #1d4ed8 100%);
    border: none;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.refine-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

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

.input-tips {
    display: flex;
    gap: 16px;
}

.tip-item {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 响应式 */
@media (max-width: 768px) {
    .refine-container {
        padding: 16px;
        gap: 16px;
    }

    .refine-main-image {
        max-width: 320px;
        border-radius: 16px;
    }

    .refine-thumb-item {
        width: 56px;
        height: 56px;
        border-radius: 10px;
    }

    .refine-input-card {
        padding: 16px;
        border-radius: 16px;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .refine-send-btn {
        justify-content: center;
    }
}

/* 旧的底部微调面板已移除，使用新的 .refine-overlay 全屏覆盖层 */

/* === 弹窗通用遮罩 === */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* === AI分析弹窗 V2 - 专业简洁风（圆润优化版） === */
.analysis-dialog-v2 {
    width: 920px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px); /* 动态视口高度 */
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.2),
                0 10px 30px -10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: dialog-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 头部 */
.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 28px 32px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(to bottom, #fafbfc, #fff);
}

.header-info h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px 0;
}

.header-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
    transform: scale(1.05);
}

/* 内容区 */
.analysis-content {
    padding: 28px 32px;
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px); /* 动态视口高度 */
    overflow-y: auto;
}

/* 输入表单 */
.analysis-form .form-intro {
    margin-bottom: 20px;
}

.analysis-form .form-intro p {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
}

.form-input-group {
    display: flex;
    gap: 14px;
}

.form-input-group input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: #fafafa;
}

.form-input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.form-input-group input::placeholder {
    color: #9ca3af;
}

.submit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: #111827;
    color: #fff;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.submit-btn:hover {
    background: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 加载状态 */
.analysis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}

.loading-spinner-v2 {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #111827;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    margin: 20px 0 8px;
    font-size: 15px;
    color: #374151;
    font-weight: 500;
}

.loading-hint {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
}

/* 分析结果 V2 */
.analysis-result-v2 {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 行布局 */
.result-row {
    display: grid;
    gap: 18px;
}

.result-row.two-col {
    grid-template-columns: 1fr 1fr;
}

.result-row.three-col {
    grid-template-columns: repeat(3, 1fr);
}

/* 结果块 - 增强圆润和过渡效果 */
.result-block {
    background: #fafbfc;
    border: 1px solid #eef0f2;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.25s ease;
}

.result-block:hover {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.result-block.compact {
    padding: 18px;
}

.result-block.compact h4 {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
}

.result-block.compact p {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
    margin: 0;
}

/* 转化建议特殊样式 */
.result-block.conversion-block {
    grid-column: span 1;
}

.conversion-content {
    font-size: 13px;
    color: #374151;
    line-height: 1.8;
    max-height: 200px;
    overflow-y: auto;
}

.conversion-content br {
    display: block;
    margin: 8px 0;
}

.block-header {
    margin-bottom: 14px;
}

.block-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.block-tag.tag-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.block-tag.tag-gray {
    background: #f3f4f6;
    color: #4b5563;
}

.block-text {
    font-size: 14px;
    color: #374151;
    line-height: 1.75;
    margin: 0;
}

/* 结果区域 - 圆润过渡 */
.result-section {
    background: #fafbfc;
    border: 1px solid #eef0f2;
    border-radius: 16px;
    padding: 22px;
    transition: all 0.25s ease;
}

.result-section:hover {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-hint {
    font-size: 12px;
    font-weight: 400;
    color: #9ca3af;
    margin-left: auto;
}

/* 洞察网格 - 圆润 */
.insight-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.insight-block {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s ease;
}

.insight-block:hover {
    border-color: #e5e7eb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.insight-block .insight-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.insight-block p {
    font-size: 13px;
    color: #374151;
    line-height: 1.65;
    margin: 0;
}

/* 提示词区域 - 圆润 */
.prompts-section {
    background: #fff;
    border: 1px solid #eef0f2;
}

.prompts-list-v2 {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prompts-list-v2 button,
.prompt-chip {
    width: 100%;
    padding: 16px 18px;
    background: #fafbfc;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    font-size: 14px;
    color: #374151;
    text-align: left;
    line-height: 1.65;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prompts-list-v2 button:hover,
.prompt-chip:hover {
    background: #fff;
    border-color: #d1d5db;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* 底部操作 */
.result-footer {
    display: flex;
    justify-content: center;
    padding-top: 12px;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* 响应式 */
@media (max-width: 768px) {
    .analysis-dialog-v2 {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh; /* 动态视口高度 */
        border-radius: 0;
    }

    .result-row.two-col,
    .result-row.three-col,
    .insight-grid {
        grid-template-columns: 1fr;
    }

    .form-input-group {
        flex-direction: column;
    }
}

/* === 图片放大弹窗 === */
.modal-backdrop.lightbox {
    background: rgba(0, 0, 0, 0.92);
    z-index: 250; /* 高于历史弹窗（200），确保从历史记录点击图片时lightbox显示在最上层 */
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: var(--transition-normal);
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#lightboxImage {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

/* Lightbox 操作按钮 */
.lightbox-actions {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-full);
    z-index: 10;
}

.lightbox-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-inverse);
    transition: var(--transition-normal);
    box-shadow: var(--shadow-glow);
}

.lightbox-action-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.5);
}

.lightbox-action-btn.secondary {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

.lightbox-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
}

/* === 历史记录弹窗 === */
.history-dialog {
    width: 720px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px); /* 动态视口高度 */
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: dialog-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dialog-header.simple {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-primary);
    text-align: left;
}

.dialog-header.simple h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.dialog-header.simple h2 svg {
    color: var(--text-tertiary);
}

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

.history-item {
    padding: 18px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    transition: var(--transition-normal);
}

.history-item:hover {
    border-color: var(--border-secondary);
    box-shadow: var(--shadow-sm);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.history-item-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.history-item-prompt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

.history-item-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.history-item-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
}

.history-item-images img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.empty-hint {
    text-align: center;
    padding: 56px 28px;
    color: var(--text-tertiary);
    font-size: 15px;
}

/* === 加载遮罩 - 科技感增强 === */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 300;
}

.loading-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: grid-flow 15s linear infinite;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(37, 99, 235, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(2) {
    inset: 12px;
    border-width: 2px;
    border-color: rgba(59, 130, 246, 0.1);
    border-top-color: #3b82f6;
    animation-duration: 0.8s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    inset: 22px;
    border-width: 2px;
    border-color: rgba(96, 165, 250, 0.1);
    border-top-color: #60a5fa;
    animation-duration: 0.6s;
}

/* 中心脉冲 */
.loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--accent-gradient);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: loading-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px var(--accent-primary);
}

@keyframes loading-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.6; }
}

.loading-content p {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 加载提示动态点 */
.loading-content p::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* === 响应式设计 === */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 340px;
    }

    .result-grid {
        max-width: 580px;
        gap: 16px;
    }

    .canvas-toolbar {
        padding: 10px 16px;
        gap: 16px;
    }

    .toolbar-btn span {
        display: none;
    }

    .toolbar-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    :root {
        --nav-height: 56px;
        --sidebar-width: 100vw;
    }

    .top-nav {
        padding: 0 16px;
    }

    .brand-text {
        display: none;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: var(--nav-height);
        bottom: 0;
        z-index: 80;
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar-inner {
        width: 100vw;
    }

    .canvas-main {
        width: 100%;
    }

    .canvas-toolbar {
        top: 12px;
        padding: 8px 12px;
        gap: 12px;
    }

    .toolbar-title {
        font-size: 13px;
    }

    .toolbar-icon {
        display: none;
    }

    .result-container {
        padding: 70px 16px 24px;
    }

    .result-grid {
        gap: 12px;
    }

    .analysis-dialog,
    .history-dialog {
        width: calc(100vw - 32px);
        margin: 16px;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* === Toast 通知系统 === */
.toast-notification {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-primary);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    z-index: 400;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
}

.toast-notification.toast-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.toast-hiding {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.toast-message {
    max-width: 320px;
    line-height: 1.5;
}

/* Toast 类型变体 */
.toast-success .toast-icon {
    background: var(--success-light);
    color: var(--success);
}

.toast-error .toast-icon {
    background: #fef2f2;
    color: var(--danger);
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: var(--warning);
}

.toast-info .toast-icon {
    background: var(--accent-light);
    color: var(--accent-primary);
}

/* === 高亮验证动画 === */
.highlight-required {
    animation: highlight-shake 0.5s ease;
}

@keyframes highlight-shake {
    0%, 100% {
        transform: translateX(0);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-4px);
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(4px);
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
    }
}

.upload-slot.highlight-required {
    border-color: var(--danger) !important;
    animation: upload-highlight 0.5s ease;
}

@keyframes upload-highlight {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.02);
    }
    50% {
        transform: scale(0.98);
    }
    75% {
        transform: scale(1.01);
    }
}

.prompt-input.highlight-required {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
}

/* === 生成按钮加载状态 === */
.generate-btn.loading {
    pointer-events: none;
    position: relative;
}

.generate-btn.loading .btn-content {
    opacity: 0;
}

.generate-btn.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* === 侧边栏切换按钮状态 === */
.nav-btn.sidebar-collapsed svg {
    transform: scaleX(-1);
}

.nav-btn.sidebar-collapsed {
    background: var(--accent-light);
    color: var(--accent-primary);
}

/* === 聊天消息样式（微调面板） === */
.chat-message {
    max-width: 85%;
    margin-bottom: 14px;
    animation: message-in 0.3s ease;
}

.chat-message.ai {
    margin-right: auto;
}

.chat-message.user {
    margin-left: auto;
}

.chat-message p {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
}

.chat-message.ai p {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-message.user p {
    background: var(--accent-gradient);
    color: var(--text-inverse);
    border-bottom-right-radius: var(--radius-sm);
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === 图片加载占位 === */
.result-item img {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    transition: opacity 0.3s ease;
}

.result-item img[src=""] {
    opacity: 0;
}

/* === 微交互增强 === */
/* 按钮点击波纹效果 */
.generate-btn::before,
.ai-analyze-btn::before,
.analyze-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.3) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.generate-btn:active::before,
.ai-analyze-btn:active::before,
.analyze-submit:active::before {
    opacity: 1;
}

/* 输入框聚焦动画 */
.prompt-input,
.drawer-input input,
.form-field input {
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.prompt-input:focus,
.drawer-input input:focus,
.form-field input:focus {
    transform: translateY(-1px);
}

/* 侧边栏收起过渡优化 */
.sidebar {
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    box-shadow: none;
}

/* 画布区域展开动画 */
.canvas-main {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 结果网格入场动画 */
.result-item {
    animation: result-item-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.result-item:nth-child(1) { animation-delay: 0.1s; }
.result-item:nth-child(2) { animation-delay: 0.2s; }
.result-item:nth-child(3) { animation-delay: 0.3s; }
.result-item:nth-child(4) { animation-delay: 0.4s; }

@keyframes result-item-in {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
        filter: blur(10px);
    }
    60% {
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* 结果项加载完成后的脉冲效果 */
.result-item.loaded::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--accent-primary);
    animation: item-loaded-pulse 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes item-loaded-pulse {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}


/* 悬停效果增强 */
.upload-slot:hover .placeholder-icon svg {
    animation: icon-wiggle 0.5s ease;
}

@keyframes icon-wiggle {
    0%, 100% {
        transform: rotate(0);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* ============================================
   AI 设计分析面板 - 简洁功能导向
   ============================================ */

.ai-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 89;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ai-panel-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* 主面板 */
.ai-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    height: 100vh;
    height: 100dvh; /* 动态视口高度 */
    background: #fff;
    border-left: 1px solid var(--border-primary);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.ai-panel.active {
    transform: translateX(0);
}

/* 头部 */
.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    background: #fff;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-panel-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: 10px;
    color: #fff;
}

.ai-panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all 0.2s ease;
}

.ai-panel-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* 内容区域 */
.ai-chat-area {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.ai-chat-area::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* 分析入口 */
.ai-analysis-entry {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 状态卡片 */
.analysis-status-card {
    background: #fff;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 16px;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-secondary);
}

.status-icon {
    color: var(--text-tertiary);
}

.status-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.status-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

.item-dot.empty {
    background: #d1d5db;
}

.item-dot.filled {
    background: #10b981;
}

.item-label {
    font-size: 13px;
    color: var(--text-secondary);
    width: 56px;
}

.item-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

/* 分析操作按钮 */
.analysis-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analysis-action-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.analysis-action-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.analysis-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.analysis-action-btn.primary:not(:disabled) {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
}

.analysis-action-btn.primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.analysis-action-btn.primary:not(:disabled) .action-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.analysis-action-btn.primary:not(:disabled) .action-title,
.analysis-action-btn.primary:not(:disabled) .action-desc {
    color: #fff;
}

.analysis-action-btn.primary:not(:disabled) .action-desc {
    opacity: 0.85;
}

/* 次要按钮启用时的强调效果 */
.analysis-action-btn.secondary.enabled {
    border-color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.04);
}

.analysis-action-btn.secondary.enabled .action-icon {
    background: rgba(37, 99, 235, 0.1);
}

.analysis-action-btn .action-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 10px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.analysis-action-btn .action-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.analysis-action-btn .action-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.analysis-action-btn .action-desc {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 提示文字 */
.analysis-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.analysis-tip svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}

/* ============================================
   分析结果样式
   ============================================ */

/* 消息容器 */
.ai-message {
    padding: 16px 20px;
    animation: fadeSlideIn 0.3s ease;
}

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

.ai-message-bubble {
    background: #fff;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 16px;
}

/* 分析结果卡片 */
.ai-analysis-card {
    background: #fff;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    margin: 16px 20px;
    overflow: hidden;
}

.ai-analysis-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-analysis-card h4::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.ai-analysis-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 14px 16px;
    margin: 0;
}

.ai-analysis-card.generated-analysis {
    border-left: 3px solid var(--accent-primary);
}

/* 总结区块 */
.ai-summary {
    font-size: 14px !important;
    font-weight: 500;
    color: var(--text-primary) !important;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-bottom: 1px solid var(--border-primary);
    margin: 0 !important;
}

/* 逐图分析 */
.individual-analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.individual-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
    padding: 14px;
    transition: all 0.2s ease;
}

.individual-item:hover {
    border-color: var(--accent-primary);
    background: #fff;
}

.individual-item .item-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.individual-item .item-score {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--accent-gradient);
    padding: 2px 8px;
    border-radius: 10px;
}

.individual-item .item-pros,
.individual-item .item-cons {
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 6px;
}

.individual-item .item-pros { color: #059669; }
.individual-item .item-cons { color: #dc2626; }
.individual-item .label { font-weight: 600; }

/* 最佳推荐 */
.best-choice {
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-top: 1px solid var(--border-primary);
    font-size: 13px;
    font-weight: 600;
    color: #b45309;
    display: flex;
    align-items: center;
    gap: 8px;
}

.best-choice::before {
    content: '👑';
}

/* 改进建议 */
.improvement-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    border-color: var(--accent-primary);
    background: #fff;
    transform: translateX(4px);
}

.suggestion-num {
    width: 24px;
    height: 24px;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.suggestion-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
}

.target-badge {
    display: inline-block;
    background: var(--accent-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
}

/* 提示词选项 */
.ai-prompts-card {
    padding: 16px;
    border-top: 1px solid var(--border-primary);
}

.ai-prompts-card h5 {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-prompt-option {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    line-height: 1.6;
}

.ai-prompt-option:hover {
    border-color: var(--accent-primary);
    background: #fff;
}

.ai-prompt-option:last-child {
    margin-bottom: 0;
}

/* 加载状态 */
.ai-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    margin: 16px 20px;
    background: #fff;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.ai-loading-dots {
    display: flex;
    gap: 4px;
}

.ai-loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: loadingPulse 1.4s infinite ease-in-out both;
}

.ai-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loadingPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* 工具栏按钮高亮 */
.nav-btn.ai-active {
    background: var(--accent-gradient);
    color: #fff;
}

/* 响应式 */
@media (max-width: 768px) {
    .ai-panel {
        width: 100vw;
    }
    .individual-analysis-grid {
        grid-template-columns: 1fr;
    }
}

/* === 画布工具栏 === */
.canvas-toolbar {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-primary);
    z-index: 20;
    animation: toolbar-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.toolbar-icon {
    font-size: 18px;
}

.result-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-normal);
}

.toolbar-btn:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

.toolbar-btn.icon-only {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

/* AI 分析按钮特殊样式 */
.toolbar-btn.ai-analyze {
    background: var(--accent-gradient);
    color: var(--text-inverse);
    box-shadow: var(--shadow-glow);
}

.toolbar-btn.ai-analyze:hover {
    background: var(--accent-gradient-hover);
    color: var(--text-inverse);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.45);
}

.toolbar-btn.ai-analyze svg {
    opacity: 1;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-secondary);
}

/* === 画布主区域优化 === */
.canvas-main {
    flex: 1;
    background:
        radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        var(--bg-canvas);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* 改为顶部对齐，方便滚动 */
    position: relative;
    overflow-y: auto; /* 允许垂直滚动 */
    overflow-x: hidden;
}

/* === 改进的四宫格结果 === */
.result-container {
    width: 100%;
    /* 使用明确的高度计算，而不是依赖百分比 */
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height)); /* dvh 作为渐进增强 */
    padding: 80px 40px 40px; /* 为工具栏留出空间 */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 100%;
    width: auto;
    /* 关键：限制网格最大高度，让图片在视口内完整显示 */
    max-height: calc(100vh - var(--nav-height) - 140px);
    max-height: calc(100dvh - var(--nav-height) - 140px); /* dvh 作为渐进增强 */
}

/* 改进的结果卡片 - 9:16竖屏比例，但高度受限于容器 */
.result-item {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.02),
        0 12px 24px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    aspect-ratio: 9 / 16;
    /* 关键：限制最大高度，让图片在视口内完整显示 */
    max-height: calc(100vh - var(--nav-height) - 160px);
    max-height: calc(100dvh - var(--nav-height) - 160px); /* dvh 作为渐进增强 */
    transform-style: preserve-3d;
    perspective: 1000px;
}

.result-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.04),
        0 24px 48px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(37, 99, 235, 0.1);
}

.result-item.selected {
    box-shadow:
        0 0 0 3px var(--accent-primary),
        0 8px 16px rgba(37, 99, 235, 0.15),
        0 24px 48px rgba(37, 99, 235, 0.2);
    transform: translateY(-8px) scale(1.02);
}

/* 图片容器 */
.item-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.item-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-item:hover .item-image-wrapper img {
    transform: scale(1.05);
}

/* 渐变遮罩 */
.item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.result-item:hover .item-overlay {
    opacity: 1;
}

/* 序号角标 - 改进 */
.item-index {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 3;
    transition: all 0.3s ease;
}

.result-item:hover .item-index {
    background: var(--accent-primary);
    color: var(--text-inverse);
    transform: scale(1.1);
}

.result-item.selected .item-index {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

/* 选中勾选标记 */
.item-check {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--success);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    box-shadow: var(--shadow-lg);
    z-index: 3;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-item.selected .item-check {
    opacity: 1;
    transform: scale(1);
}

/* 操作按钮 - 改进 */
.item-actions {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 4;
}

.result-item:hover .item-actions {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    background: var(--text-primary);
    color: var(--text-inverse);
    transform: translateY(-4px) scale(1.1);
    box-shadow: var(--shadow-xl);
}

.action-btn.select-btn:hover {
    background: var(--accent-primary);
}

.action-btn.download-btn:hover {
    background: var(--success);
}

.action-btn.zoom-btn:hover {
    background: var(--text-primary);
}

/* === 隐藏数字角标 === */
.item-index {
    display: none !important;
}

/* === 历史记录项样式增强 === */
.history-item-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.history-item-badge.generation {
    background: var(--accent-light);
    color: var(--accent-primary);
}

.history-item-badge.refinement {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.history-restore-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
}

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

.history-restore-btn svg {
    flex-shrink: 0;
}

/* === 工具类 === */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* === 新手引导系统 - 玻璃态设计 === */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 毛玻璃背景遮罩 */
.onboarding-mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.onboarding-mask > div {
    position: absolute;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.mask-top {
    top: 0;
    left: 0;
    right: 0;
    height: 0;
}

.mask-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
}

.mask-left {
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
}

.mask-right {
    right: 0;
    top: 0;
    width: 0;
    height: 100%;
}

/* 聚光灯高亮边框 - 光晕效果 */
.onboarding-overlay::before {
    content: '';
    position: absolute;
    top: var(--onboarding-highlight-top, 0);
    left: var(--onboarding-highlight-left, 0);
    width: var(--onboarding-highlight-width, 0);
    height: var(--onboarding-highlight-height, 0);
    border: 2px solid var(--accent-primary);
    border-radius: 20px;
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.15),
        0 0 30px rgba(99, 102, 241, 0.25),
        inset 0 0 20px rgba(99, 102, 241, 0.08);
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: spotlight-glow 2.5s ease-in-out infinite;
    z-index: 1;
}

@keyframes spotlight-glow {
    0%, 100% {
        box-shadow:
            0 0 0 4px rgba(99, 102, 241, 0.15),
            0 0 30px rgba(99, 102, 241, 0.25),
            inset 0 0 20px rgba(99, 102, 241, 0.08);
        transform: scale(1);
    }
    50% {
        box-shadow:
            0 0 0 6px rgba(99, 102, 241, 0.12),
            0 0 50px rgba(99, 102, 241, 0.35),
            inset 0 0 30px rgba(99, 102, 241, 0.12);
        transform: scale(1.01);
    }
}

/* 玻璃态引导卡片 */
.onboarding-card {
    position: fixed;
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px); /* 留更多空间给任务栏 */
    max-height: calc(100dvh - 60px); /* 使用动态视口高度 */
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow:
        0 25px 60px -12px rgba(0, 0, 0, 0.25),
        0 12px 28px -8px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    z-index: 10001;
    pointer-events: auto;
    animation: card-float-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes card-float-in {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 卡片头部 - 步骤指示器 */
.onboarding-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

/* 圆点进度指示器 */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.step-dot.active {
    width: 28px;
    border-radius: 4px;
    background: var(--accent-gradient);
}

.step-dot.completed {
    background: var(--success);
}

/* 隐藏旧的步骤数字（向后兼容） */
.step-current,
.step-separator,
.step-total {
    display: none;
}

.skip-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-secondary);
    border-radius: 20px;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skip-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border-primary);
}

/* 卡片内容区 */
.onboarding-card .card-content {
    padding: 32px 28px 24px;
    text-align: center;
    flex: 1;
    overflow-y: auto;
}

/* 图标容器 - 玻璃态 */
.card-icon,
#guideIcon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
}

.card-icon svg,
#guideIcon svg {
    width: 36px;
    height: 36px;
    stroke: var(--accent-primary);
    stroke-width: 1.5;
    fill: none;
}

.card-title,
#guideTitle {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.card-desc,
#guideDesc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 320px;
    margin: 0 auto;
}

/* 卡片底部按钮 */
.onboarding-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px 24px;
    gap: 12px;
    flex-shrink: 0;
}

.prev-btn, .next-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.prev-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.prev-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateX(-2px);
}

.prev-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    transition: transform 0.2s ease;
}

.prev-btn:hover svg {
    transform: translateX(-3px);
}

.next-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.next-btn:hover {
    transform: translateY(-2px) translateX(2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.next-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    transition: transform 0.2s ease;
}

.next-btn:hover svg {
    transform: translateX(3px);
}

.next-btn.finish {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.next-btn.finish:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

/* 高亮指示箭头 */
.onboarding-arrow {
    position: absolute;
    width: 44px;
    height: 44px;
    z-index: 5;
    animation: arrow-float 1.2s ease-in-out infinite;
}

.onboarding-arrow svg {
    width: 100%;
    height: 100%;
    fill: var(--accent-primary);
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.5));
}

@keyframes arrow-float {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-10px);
        opacity: 0.8;
    }
}

/* 重新开始引导按钮 */
.restart-guide-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.restart-guide-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* 响应式 - 引导卡片 */

/* 小高度屏幕（任务栏或浏览器工具栏占用空间） */
@media (max-height: 700px) {
    .onboarding-card {
        max-height: calc(100dvh - 80px);
    }

    .onboarding-card .card-content {
        padding: 20px 24px 16px;
    }

    .onboarding-card .card-header {
        padding: 16px 20px 12px;
    }

    .onboarding-card .card-footer {
        padding: 12px 20px 16px;
    }

    .card-icon,
    #guideIcon {
        width: 56px;
        height: 56px;
        margin-bottom: 14px;
    }

    .card-icon svg,
    #guideIcon svg {
        width: 28px;
        height: 28px;
    }

    .card-title,
    #guideTitle {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .card-desc,
    #guideDesc {
        font-size: 13px;
        line-height: 1.6;
    }

    .prev-btn, .next-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
}

/* 极小高度屏幕 */
@media (max-height: 550px) {
    .onboarding-card {
        max-height: calc(100dvh - 40px);
    }

    .onboarding-card .card-content {
        padding: 14px 18px 12px;
    }

    .onboarding-card .card-header {
        padding: 12px 16px 10px;
    }

    .onboarding-card .card-footer {
        padding: 10px 16px 12px;
    }

    .card-icon,
    #guideIcon {
        width: 44px;
        height: 44px;
        margin-bottom: 10px;
        border-radius: 14px;
    }

    .card-icon svg,
    #guideIcon svg {
        width: 22px;
        height: 22px;
    }

    .card-title,
    #guideTitle {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .card-desc,
    #guideDesc {
        font-size: 12px;
        line-height: 1.5;
        max-width: 280px;
    }

    .prev-btn, .next-btn {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 10px;
    }

    .step-dot {
        width: 6px;
        height: 6px;
    }

    .step-dot.active {
        width: 20px;
    }

    .skip-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* 窄屏幕 */
@media (max-width: 768px) {
    .onboarding-card {
        width: calc(100vw - 32px);
        max-width: 380px;
    }

    .onboarding-card .card-content {
        padding: 24px 20px 20px;
    }

    .card-title,
    #guideTitle {
        font-size: 20px;
    }

    .card-desc,
    #guideDesc {
        font-size: 14px;
    }
}

/* 窄屏+小高度组合 */
@media (max-width: 768px) and (max-height: 600px) {
    .onboarding-card {
        width: calc(100vw - 24px);
        max-width: 340px;
        border-radius: 18px;
    }
}

/* === 重新生成遮罩层 === */
.regenerate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: calc(var(--sidebar-width) + 40px);
}

.regenerate-overlay.active {
    opacity: 1;
}

.regenerate-overlay.hiding {
    opacity: 0;
}

/* 聚光灯效果 - 照亮侧边栏 */
.regenerate-spotlight {
    position: fixed;
    left: 0;
    top: var(--nav-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height)); /* 动态视口高度 */
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 60px rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

/* 提示卡片 */
.regenerate-hint {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-xl);
    animation: slideInHint 0.4s ease-out;
    max-width: 360px;
}

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

.regenerate-hint .hint-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.regenerate-hint .hint-text h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.regenerate-hint .hint-text p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.regenerate-hint .hint-close-btn {
    padding: 8px 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.regenerate-hint .hint-close-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

/* 提示词输入框高亮脉冲效果 */
.prompt-input.highlight-pulse {
    animation: promptPulse 1.5s ease-in-out infinite;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), var(--shadow-md) !important;
}

@keyframes promptPulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), var(--shadow-md);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.1), 0 0 20px rgba(37, 99, 235, 0.2), var(--shadow-md);
    }
}

/* 高亮必填项效果（复用） */
.highlight-required {
    animation: highlightShake 0.5s ease-in-out;
    border-color: var(--warning) !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

@keyframes highlightShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* === 微调快捷建议 === */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.suggestion-chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-1px);
}

.suggestion-chip:active {
    transform: translateY(0);
}

/* ============================================
   响应式设计 - 全面优化
   ============================================ */

/* === 大屏幕 (1400px+) === */
@media (min-width: 1400px) {
    .result-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* === 中大屏幕 (1200px - 1399px) === */
@media (max-width: 1399px) {
    :root {
        --sidebar-width: 340px;
    }
}

/* === 中等屏幕 (1024px - 1199px) === */
@media (max-width: 1199px) {
    :root {
        --sidebar-width: 320px;
    }

    .top-nav {
        padding: 0 16px;
    }

    .nav-brand {
        margin-left: 8px;
    }

    .nav-btn span {
        display: none;
    }

    .nav-btn {
        padding: 10px;
    }

    /* 结果网格 */
    .result-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px;
    }

    /* 分析弹窗 */
    .analysis-dialog-v2 {
        width: 800px;
    }

    .result-row.three-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .result-row.three-col .result-block:last-child {
        grid-column: 1 / -1;
    }
}

/* === 平板/小屏幕 (768px - 1023px) === */
@media (max-width: 1023px) {
    :root {
        --sidebar-width: 300px;
        --nav-height: 56px;
    }

    /* 导航栏紧凑 */
    .top-nav {
        padding: 0 12px;
    }

    .brand-text {
        font-size: 15px;
    }

    /* 侧边栏 */
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--nav-height);
        height: calc(100vh - var(--nav-height));
        height: calc(100dvh - var(--nav-height)); /* 动态视口高度 */
        z-index: 150;
        transform: translateX(0);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    /* 侧边栏收起时的遮罩 */
    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        top: var(--nav-height);
        background: rgba(0, 0, 0, 0.3);
        z-index: 140;
        opacity: 1;
        transition: opacity 0.35s ease;
        pointer-events: auto;
    }

    body::after {
        content: '';
        position: fixed;
        inset: 0;
        top: var(--nav-height);
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.35s ease, z-index 0s 0.35s;
    }

    body.sidebar-open::after {
        z-index: 140;
        transition: opacity 0.35s ease, z-index 0s 0s;
    }

    /* 主内容区 */
    .canvas-main {
        margin-left: 0;
        width: 100%;
    }

    /* 画布工具栏 */
    .canvas-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 16px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }

    .toolbar-btn span {
        display: none;
    }

    /* 结果网格 */
    .result-container {
        padding: 16px;
    }

    .result-grid {
        gap: 12px;
    }

    /* 分析弹窗 */
    .analysis-dialog-v2 {
        width: calc(100vw - 32px);
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px); /* 动态视口高度 */
        border-radius: 16px;
    }

    .analysis-header {
        padding: 20px 24px;
    }

    .analysis-content {
        padding: 20px 24px;
    }

    .result-row.two-col,
    .result-row.three-col {
        grid-template-columns: 1fr;
    }

    .insight-grid {
        grid-template-columns: 1fr;
    }

    /* AI 分析面板 */
    .ai-panel {
        width: 100%;
        max-width: 400px;
    }

    /* 微调面板 */
    .refine-container {
        padding: 20px;
        gap: 20px;
    }

    .refine-main-image {
        max-width: 400px;
    }

    /* 引导卡片 */
    .onboarding-card {
        width: calc(100vw - 24px);
        max-width: 360px;
    }
}

/* === 手机横屏/小平板 (640px - 767px) === */
@media (max-width: 767px) {
    :root {
        --sidebar-width: 100%;
        --nav-height: 52px;
    }

    /* 导航栏 */
    .top-nav {
        padding: 0 10px;
    }

    .nav-brand {
        margin-left: 4px;
    }

    .brand-icon {
        font-size: 20px;
    }

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

    .nav-btn.icon-btn {
        width: 40px;
        height: 40px;
    }

    /* 侧边栏全屏覆盖 */
    .sidebar {
        width: 100%;
        border-right: none;
    }

    .sidebar-inner {
        padding: 16px;
    }

    .sidebar-section {
        margin-bottom: 16px;
    }

    /* 上传卡片 */
    .upload-card {
        padding: 16px;
        border-radius: 16px;
    }

    .upload-stack {
        gap: 12px;
    }

    .upload-slot {
        min-height: 120px;
        border-radius: 12px;
    }

    /* 提示词卡片 */
    .prompt-card {
        padding: 14px;
        border-radius: 14px;
    }

    .prompt-input {
        min-height: 100px;
        font-size: 14px;
    }

    /* 生成按钮 */
    .generate-btn {
        padding: 14px 24px;
        border-radius: 14px;
    }

    /* 空状态响应式 */
    .canvas-empty {
        padding: 32px 20px;
        min-height: 320px;
        height: calc(100vh - var(--nav-height));
        height: calc(100dvh - var(--nav-height));
    }

    .empty-visual {
        width: 140px;
        height: 140px;
        margin-bottom: 32px;
    }

    .glow-ring.delay {
        inset: -18px;
    }

    .orbit-ring {
        inset: 18px;
    }

    .orbit-dot {
        width: 8px;
        height: 8px;
        top: -4px;
    }

    .center-icon {
        width: 64px;
        height: 64px;
        border-radius: 18px;
    }

    .center-icon svg {
        width: 28px;
        height: 28px;
    }

    .empty-title {
        font-size: 20px;
    }

    .empty-desc {
        font-size: 13px;
    }

    /* 结果网格 - 单列 */
    .result-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .result-item {
        border-radius: 12px;
    }

    /* 画布工具栏 */
    .canvas-toolbar {
        padding: 10px 12px;
    }

    .toolbar-title span {
        font-size: 13px;
    }

    /* 分析弹窗 */
    .analysis-dialog-v2 {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .analysis-header {
        padding: 16px 20px;
    }

    .header-info h2 {
        font-size: 18px;
    }

    .analysis-content {
        padding: 16px 20px;
        max-height: calc(100vh - 120px);
        max-height: calc(100dvh - 120px); /* 动态视口高度 */
    }

    .result-block {
        padding: 14px;
        border-radius: 12px;
    }

    .prompts-list-v2 .prompt-tag {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* AI 分析面板 - 全屏 */
    .ai-panel {
        width: 100%;
        max-width: none;
        border-radius: 0;
    }

    .ai-panel-header {
        padding: 14px 16px;
    }

    .ai-analysis-entry {
        padding: 16px;
    }

    .analysis-status-card {
        padding: 14px;
        border-radius: 10px;
    }

    .analysis-action-btn {
        padding: 14px;
        border-radius: 10px;
    }

    .analysis-action-btn .action-icon {
        width: 40px;
        height: 40px;
    }

    /* 微调面板 - 全屏 */
    .refine-overlay {
        padding: 0;
    }

    .refine-container {
        padding: 16px;
        gap: 16px;
        border-radius: 0;
        height: 100vh;
        height: 100dvh; /* 动态视口高度 */
        max-height: none;
    }

    .refine-close-btn {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .refine-main-image {
        max-width: 100%;
        max-height: 50vh;
        aspect-ratio: 9 / 16;
    }

    .refine-thumbnails {
        gap: 8px;
    }

    .refine-thumb-item {
        width: 36px;
        height: 64px;
    }

    .refine-input-card {
        padding: 14px;
        border-radius: 14px;
    }

    .input-wrapper {
        flex-direction: column;
        gap: 12px;
    }

    .refine-send-btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    /* 历史弹窗 */
    .history-dialog {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
    }

    /* Lightbox */
    .lightbox-actions {
        padding: 12px 16px;
        gap: 12px;
    }

    .lightbox-action-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    /* 引导遮罩层优化 */
    .onboarding-card {
        width: calc(100vw - 32px);
        max-width: 380px;
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px); /* 动态视口高度 */
        border-radius: 20px;
    }

    .onboarding-card .card-header {
        padding: 16px 18px 12px;
    }

    .onboarding-card .card-content {
        padding: 20px 18px 16px;
    }

    .card-icon {
        width: 56px;
        height: 56px;
    }

    .card-title,
    #guideTitle {
        font-size: 18px;
    }

    .card-desc,
    #guideDesc {
        font-size: 13px;
        line-height: 1.6;
    }

    .onboarding-card .card-footer {
        padding: 14px 18px 18px;
    }

    .prev-btn,
    .next-btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    /* 加载遮罩 */
    .loading-content p {
        font-size: 14px;
    }
}

/* === 手机竖屏 (480px 以下) === */
@media (max-width: 479px) {
    :root {
        --nav-height: 48px;
    }

    /* 导航栏极简 */
    .top-nav {
        padding: 0 8px;
        gap: 4px;
    }

    .nav-left {
        gap: 4px;
    }

    .nav-right {
        gap: 4px;
    }

    .nav-btn.icon-btn {
        width: 36px;
        height: 36px;
    }

    .brand-text {
        font-size: 13px;
    }

    /* 侧边栏 */
    .sidebar-inner {
        padding: 12px;
    }

    .upload-slot {
        min-height: 100px;
    }

    .placeholder-text {
        font-size: 13px;
    }

    .placeholder-hint {
        font-size: 11px;
    }

    /* 画布区域极简响应式 */
    .canvas-empty {
        min-height: 280px;
        padding: 24px 16px;
        height: calc(100vh - var(--nav-height));
        height: calc(100dvh - var(--nav-height));
    }

    .empty-visual {
        width: 110px;
        height: 110px;
        margin-bottom: 24px;
    }

    .glow-ring.delay {
        inset: -14px;
    }

    .orbit-ring {
        inset: 14px;
    }

    .orbit-dot {
        width: 6px;
        height: 6px;
        top: -3px;
    }

    .center-icon {
        width: 52px;
        height: 52px;
        border-radius: 14px;
    }

    .center-icon svg {
        width: 24px;
        height: 24px;
    }

    .empty-title {
        font-size: 18px;
    }

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

    /* 引导卡片 */
    .onboarding-card {
        border-radius: 16px;
    }

    .card-icon {
        width: 48px;
        height: 48px;
    }

    .card-icon svg {
        width: 24px;
        height: 24px;
    }

    .card-title,
    #guideTitle {
        font-size: 16px;
    }

    .card-desc,
    #guideDesc {
        font-size: 12px;
    }

    .step-indicator {
        gap: 6px;
    }

    .step-current,
    .step-total {
        font-size: 13px;
    }

    /* 工具栏按钮 */
    .toolbar-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* 分析弹窗 */
    .header-info h2 {
        font-size: 16px;
    }

    .header-subtitle {
        font-size: 12px;
    }

    .section-title {
        font-size: 13px;
    }

    .block-text {
        font-size: 13px;
    }

    /* AI面板 */
    .ai-panel-title {
        font-size: 15px;
    }

    .analysis-action-btn .action-title {
        font-size: 14px;
    }

    .analysis-action-btn .action-desc {
        font-size: 11px;
    }

    /* 微调面板 */
    .input-title {
        font-size: 14px;
    }

    #refineInput {
        font-size: 14px;
    }

    .tip-item {
        font-size: 11px;
    }
}

/* === 引导遮罩层位置自适应 === */
@media (max-height: 700px) {
    .onboarding-card {
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px); /* 动态视口高度 */
    }

    .onboarding-card .card-content {
        padding: 16px;
    }

    .card-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }
}

/* === 横屏模式优化 === */
@media (max-height: 500px) and (orientation: landscape) {
    .onboarding-card {
        flex-direction: row;
        max-width: 600px;
        width: auto;
    }

    .onboarding-card .card-content {
        flex: 1;
        padding: 16px;
    }

    .card-icon {
        display: none;
    }

    .refine-container {
        flex-direction: row;
        gap: 16px;
    }

    .refine-main-image {
        max-width: 50%;
        max-height: 80vh;
        aspect-ratio: 9 / 16;
    }

    .refine-input-card {
        flex: 1;
    }
}

/* === 触摸设备优化 === */
@media (hover: none) and (pointer: coarse) {
    /* 增大点击区域 */
    .nav-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .action-btn {
        min-width: 40px;
        min-height: 40px;
    }

    .toolbar-btn {
        min-height: 40px;
        padding: 8px 14px;
    }

    /* 移除悬停效果 */
    .result-item:hover {
        transform: none;
    }

    .upload-slot:hover {
        transform: none;
        border-color: var(--border-primary);
    }

    /* 按下效果替代悬停 */
    .result-item:active {
        transform: scale(0.98);
    }

    .upload-slot:active {
        transform: scale(0.98);
        border-color: var(--accent-primary);
    }
}

/* === 高对比度/可访问性 === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === 打印样式 === */
@media print {
    .top-nav,
    .sidebar,
    .canvas-toolbar,
    .modal-backdrop,
    .loading-overlay,
    .onboarding-overlay {
        display: none !important;
    }

    .canvas-main {
        margin: 0;
        padding: 0;
    }

    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .result-item {
        aspect-ratio: 9 / 16;
    }
}

/* ============================================
   小高度屏幕全面适配
   ============================================ */

/* === 中等高度屏幕 (600px - 800px) === */
@media (max-height: 800px) {
    :root {
        --nav-height: 56px;
    }

    .sidebar-section {
        padding: 14px 20px;
    }

    .upload-card {
        padding: 14px;
    }

    .upload-stack {
        gap: 12px;
    }

    .prompt-input {
        min-height: 80px;
    }

    .generate-btn {
        padding: 12px 20px;
    }
}

/* === 小高度屏幕 (500px - 600px) === */
@media (max-height: 600px) {
    :root {
        --nav-height: 48px;
    }

    .top-nav {
        padding: 0 12px;
    }

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

    .nav-btn.icon-btn {
        width: 36px;
        height: 36px;
    }

    .sidebar-section {
        padding: 10px 16px;
    }

    .sidebar-section:first-child {
        padding-top: 10px;
    }

    .upload-card {
        padding: 12px;
        border-radius: 14px;
    }

    .upload-stack {
        gap: 10px;
    }

    /* 上传槽位紧凑 */
    #modelUpload {
        aspect-ratio: 9 / 12; /* 更紧凑的比例 */
    }

    .placeholder-icon {
        width: 48px;
        height: 48px;
    }

    .placeholder-icon svg {
        width: 24px;
        height: 24px;
    }

    .placeholder-text {
        font-size: 12px;
    }

    .placeholder-hint {
        font-size: 10px;
    }

    .slot-label {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* 提示词区域 */
    .prompt-card {
        padding: 12px;
        border-radius: 12px;
    }

    .prompt-select {
        padding: 8px 12px;
        font-size: 12px;
    }

    .prompt-input {
        min-height: 60px;
        font-size: 13px;
        padding: 10px;
    }

    /* 生成按钮 */
    .sidebar-footer {
        padding: 10px 16px 16px;
    }

    .generate-btn {
        padding: 10px 16px;
        border-radius: 12px;
        font-size: 14px;
    }

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

    /* AI 分析按钮 */
    .ai-analyze-btn {
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 10px;
    }

    /* 结果区域 */
    .result-container {
        padding: 60px 24px 24px;
    }

    .result-grid {
        gap: 12px;
    }

    .result-item {
        max-height: calc(100vh - var(--nav-height) - 120px);
        max-height: calc(100dvh - var(--nav-height) - 120px); /* dvh 渐进增强 */
        border-radius: 12px;
    }

    /* 画布工具栏 */
    .canvas-toolbar {
        padding: 8px 16px;
    }

    .toolbar-title span {
        font-size: 12px;
    }

    .toolbar-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* === 极小高度屏幕 (<500px) === */
@media (max-height: 500px) {
    :root {
        --nav-height: 44px;
    }

    .top-nav {
        padding: 0 8px;
    }

    .brand-text {
        font-size: 13px;
    }

    .nav-btn.icon-btn {
        width: 32px;
        height: 32px;
    }

    .nav-btn svg {
        width: 14px;
        height: 14px;
    }

    /* 侧边栏极度紧凑 */
    .sidebar-inner {
        padding: 8px;
    }

    .sidebar-section {
        padding: 8px 12px;
    }

    .upload-card {
        padding: 8px;
        border-radius: 10px;
    }

    .upload-stack {
        gap: 8px;
    }

    /* 上传区域更紧凑 */
    #modelUpload {
        aspect-ratio: 9 / 10;
    }

    #clothingUpload {
        aspect-ratio: 1 / 1;
        max-height: 100px;
    }

    .placeholder-icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .placeholder-icon svg {
        width: 18px;
        height: 18px;
    }

    .placeholder-text {
        font-size: 11px;
    }

    .placeholder-hint {
        display: none; /* 隐藏提示文字节省空间 */
    }

    .slot-label {
        font-size: 9px;
        padding: 2px 6px;
    }

    /* 提示词区域 */
    .prompt-card {
        padding: 8px;
        border-radius: 10px;
    }

    .prompt-select {
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 6px;
    }

    .prompt-input {
        min-height: 50px;
        font-size: 12px;
        padding: 8px;
        border-radius: 8px;
    }

    /* 生成按钮 */
    .sidebar-footer {
        padding: 8px 12px 12px;
    }

    .generate-btn {
        padding: 8px 14px;
        border-radius: 10px;
        font-size: 13px;
    }

    .generate-btn svg {
        width: 14px;
        height: 14px;
    }

    /* AI 分析按钮 */
    .ai-analyze-btn {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 8px;
    }

    /* 结果区域 */
    .result-container {
        padding: 50px 16px 16px;
    }

    .result-grid {
        gap: 8px;
    }

    .result-item {
        max-height: calc(100vh - var(--nav-height) - 100px);
        max-height: calc(100dvh - var(--nav-height) - 100px); /* dvh 渐进增强 */
        border-radius: 10px;
    }

    /* 工具栏更紧凑 */
    .canvas-toolbar {
        padding: 6px 12px;
    }

    .toolbar-title span {
        font-size: 11px;
    }

    .toolbar-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .toolbar-btn span {
        display: none;
    }

    /* 空状态适配 */
    .canvas-empty {
        padding: 20px 16px;
        min-height: 200px;
        height: calc(100vh - var(--nav-height));
        height: calc(100dvh - var(--nav-height));
    }

    .empty-visual {
        width: 80px;
        height: 80px;
        margin-bottom: 16px;
    }

    .empty-title {
        font-size: 16px;
    }

    .empty-desc {
        font-size: 11px;
    }
}

/* === 组合：窄屏幕 + 小高度 === */
@media (max-width: 768px) and (max-height: 600px) {
    /* 侧边栏在窄屏+小高度时更紧凑 */
    .sidebar-inner {
        padding: 10px;
    }

    .upload-stack {
        flex-direction: row;
        gap: 10px;
    }

    #modelUpload,
    #clothingUpload {
        flex: 1;
        aspect-ratio: auto;
        min-height: 100px;
        max-height: 120px;
    }

    .prompt-input {
        min-height: 50px;
    }
}
