/* ============================================
   统一创作页面样式
   深色主题，支持多文件上传、模式切换、参数配置
   ============================================ */

/* --- 创作页面整体布局 --- */
.create-page {
    padding: 28px 0 60px;
    min-height: calc(100vh - 64px - 300px);
}

.create-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 28px;
    align-items: start;
}

/* ============================================
   左侧：多文件上传区
   ============================================ */
.upload-panel {
    position: sticky;
    top: 92px;
}

/* 上传网格 */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* 单个上传槽 */
.upload-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bg-card);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    overflow: hidden;
    gap: 6px;
}

.upload-slot:hover {
    border-color: rgba(79, 110, 246, 0.4);
    background: rgba(79, 110, 246, 0.04);
    box-shadow: 0 0 20px rgba(79, 110, 246, 0.06);
}

.upload-slot.drag-over {
    border-color: var(--color-primary);
    background: rgba(79, 110, 246, 0.08);
    box-shadow: 0 0 30px rgba(79, 110, 246, 0.12);
}

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

.upload-slot.is-main {
    border-color: rgba(79, 110, 246, 0.2);
    border-style: dashed;
}

/* 上传图标 */
.upload-slot-icon {
    font-size: 1.8rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.upload-slot:hover .upload-slot-icon {
    color: var(--color-primary-light);
    transform: scale(1.08);
}

.upload-slot-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* 文件预览缩略图 */
.upload-slot-preview {
    position: absolute;
    inset: 0;
    display: none;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.upload-slot-preview.show {
    display: block;
}

.upload-slot-preview img,
.upload-slot-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-slot-preview .audio-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    gap: 8px;
    padding: 10px;
}

.audio-preview-icon {
    font-size: 2rem;
}

.audio-preview-name {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    word-break: break-all;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 移除按钮 */
.upload-slot-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all var(--transition);
    line-height: 1;
}

.upload-slot.has-file .upload-slot-remove {
    display: flex;
}

.upload-slot-remove:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* 文件类型角标 */
.upload-slot-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    padding: 2px 7px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    font-size: 0.65rem;
    color: #ccc;
    display: none;
    z-index: 2;
}

.upload-slot.has-file .upload-slot-badge {
    display: block;
}

/* 隐藏的文件输入 */
.upload-input-hidden {
    display: none;
}

/* 上传提示条 */
.upload-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 0 4px;
}

.upload-info-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-info-count {
    font-size: 0.8rem;
    color: var(--color-primary-light);
    font-weight: 500;
}

.upload-clear-btn {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
    font-family: var(--font-family);
}

.upload-clear-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

/* ============================================
   右侧：配置面板
   ============================================ */
.config-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- 提示词输入区 --- */
.prompt-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.prompt-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 文本域 + 高亮层容器 */
.prompt-input-wrapper {
    position: relative;
}

/* 高亮层 — 在 textarea 后面显示带颜色的 @mention */
.prompt-highlight {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 12px 14px;
    font-size: 0.9rem;
    line-height: 1.6;
    font-family: var(--font-family);
    color: var(--text-primary);
    pointer-events: none;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    box-sizing: border-box;
}

/* @mention 高亮色 */
.prompt-highlight .hl-image { color: #a5b4fc; font-weight: 500; }
.prompt-highlight .hl-video { color: #67e8f9; font-weight: 500; }
.prompt-highlight .hl-audio { color: #fbbf24; font-weight: 500; }

/* 占位符 — 仅在高亮层无内容时显示 */
.prompt-input-wrapper:has(.prompt-textarea:placeholder-shown) .prompt-highlight::after {
    content: attr(data-placeholder);
    color: var(--text-muted);
}
.prompt-highlight[data-placeholder]::after {
    content: attr(data-placeholder);
    color: var(--text-muted);
}

.prompt-textarea {
    width: 100%;
    min-height: 90px;
    background: transparent !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.9rem;
    color: transparent !important;
    caret-color: #fff;
    font-family: var(--font-family);
    resize: vertical;
    outline: none;
    line-height: 1.6;
    transition: border-color var(--transition);
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

.prompt-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 110, 246, 0.08);
}

.prompt-textarea::placeholder {
    color: var(--text-muted);
}

.prompt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.prompt-tag {
    padding: 4px 12px;
    background: rgba(79, 110, 246, 0.08);
    border: 1px solid rgba(79, 110, 246, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    color: var(--color-primary-light);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: var(--font-family);
}

.prompt-tag:hover {
    background: rgba(79, 110, 246, 0.15);
    border-color: rgba(79, 110, 246, 0.3);
}

/* --- 通用选项卡片 --- */
.option-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

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

.option-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.option-card-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* --- 模式切换 --- */
.mode-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
}

.mode-option {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    white-space: nowrap;
}

.mode-option.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(79, 110, 246, 0.3);
}

.mode-option:hover:not(.active) {
    color: var(--text-secondary);
}

/* --- 模型选择下拉 --- */
.model-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b6b8a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.model-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 110, 246, 0.08);
}

.model-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* 模型信息 */
.model-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(79, 110, 246, 0.04);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- 比例选择 --- */
.ratio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ratio-option {
    padding: 8px 13px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    text-align: center;
    min-width: 52px;
}

.ratio-option:hover {
    border-color: rgba(79, 110, 246, 0.3);
}

.ratio-option.active {
    border-color: var(--color-primary);
    background: rgba(79, 110, 246, 0.1);
    color: var(--color-primary-light);
}

.ratio-icon {
    display: block;
    font-size: 0.85rem;
    margin-top: 2px;
}

/* --- 时长选择下拉 --- */
.duration-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b6b8a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.duration-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 110, 246, 0.08);
}

/* --- 清晰度选择 --- */
.quality-group {
    display: flex;
    gap: 10px;
}

.quality-option {
    flex: 1;
    padding: 12px 10px;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.quality-option:hover {
    border-color: rgba(79, 110, 246, 0.3);
}

.quality-option.active {
    border-color: var(--color-primary);
    background: rgba(79, 110, 246, 0.1);
    color: var(--color-primary-light);
}

.quality-badge {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* --- 生成数量 --- */
.count-group {
    display: flex;
    gap: 8px;
}

.count-option {
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
}

.count-option:hover {
    border-color: rgba(79, 110, 246, 0.3);
}

.count-option.active {
    border-color: var(--color-primary);
    background: rgba(79, 110, 246, 0.1);
    color: var(--color-primary-light);
}

/* --- 生成按钮 --- */
.generate-section {
    margin-top: 4px;
}

.btn-generate {
    width: 100%;
    padding: 15px 24px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    box-shadow: 0 4px 20px rgba(79, 110, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-generate:hover {
    box-shadow: 0 6px 30px rgba(79, 110, 246, 0.45);
    transform: translateY(-1px);
}

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

.btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.generate-icon {
    font-size: 1.2rem;
}

.generate-cost {
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.8;
}

.cost-info {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.cost-info span {
    color: var(--color-primary-light);
    font-weight: 500;
}

/* ============================================
   生成中遮罩
   ============================================ */
.generating-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.generating-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.generating-text {
    font-size: 1rem;
    color: var(--text-secondary);
}

.generating-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.generating-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* ============================================
   历史结果区
   ============================================ */
.result-section {
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.result-tabs {
    display: flex;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}
.result-tab {
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b6b8a;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.result-tab.active {
    background: var(--color-primary);
    color: #fff;
}
.result-tab:hover:not(.active) { color: #a0a0c0; }
.result-cleanup-notice {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ef4444;
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: 8px;
    margin-top: 20px;
    padding: 12px 16px;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.result-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}
.result-grid::-webkit-scrollbar { width: 5px; }
.result-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.result-item {
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.result-item:hover {
    border-color: rgba(79, 110, 246, 0.4);
    transform: scale(1.03);
}

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

.result-item-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 1024px) {
    .create-layout {
        grid-template-columns: 1fr 350px;
        gap: 20px;
    }

    .upload-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .create-layout {
        grid-template-columns: 1fr;
    }

    .upload-panel {
        position: static;
    }

    .upload-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .config-panel {
        gap: 12px;
    }

    .inspire-modal {
        width: 95vw;
        max-height: 80vh;
        border-radius: var(--radius-lg);
    }

    .inspire-cat-tabs {
        gap: 2px;
    }

    .inspire-cat-tab {
        padding: 8px 14px;
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .create-page {
        padding: 14px 0 30px;
    }

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

    .ratio-group {
        gap: 5px;
    }

    .ratio-option {
        padding: 6px 9px;
        font-size: 0.75rem;
    }

    .inspire-modal {
        width: 98vw;
        max-height: 85vh;
    }

    .inspire-keyword {
        font-size: 0.76rem;
        padding: 6px 12px;
    }
}

/* ============================================
   上传区点击3选项菜单
   ============================================ */
.upload-source-menu {
    position: fixed;
    background: #15152a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 11px;
    padding: 5px;
    z-index: 300;
    min-width: 200px;
    box-shadow: 0 10px 36px rgba(0,0,0,0.6);
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.upload-source-menu.show {
    opacity: 1;
    transform: translateY(0);
}

.upload-source-item {
    padding: 11px 16px;
    border-radius: 7px;
    font-size: 0.86rem;
    color: #a0a0c0;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: transparent;
    text-align: left;
    font-family: var(--font-family);
    width: 100%;
}

.upload-source-item:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

/* ============================================
   素材库完整弹窗
   ============================================ */
.mat-lib-full-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
    z-index: 900;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: all 0.25s;
}
.mat-lib-full-overlay.show { opacity: 1; visibility: visible; }

.mat-lib-full-dialog {
    background: #15152a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    width: 820px; max-width: 96vw; height: 560px; max-height: 85vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.mat-lib-full-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    font-size: 1rem; font-weight: 600;
}

.mat-lib-full-close {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.04); border: none;
    color: #6b6b8a; cursor: pointer; font-size: 0.9rem;
}
.mat-lib-full-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* 搜索筛选行 */
.mat-lib-full-toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    flex-shrink: 0;
}

/* 分类标签行 */
.mat-lib-full-cats {
    display: flex; gap: 6px; padding: 12px 20px;
    overflow-x: auto; flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    scrollbar-width: none;
}
.mat-lib-full-cats::-webkit-scrollbar { display: none; }

/* 网格 — 固定显示2排(4列=8个), 超出左侧滚动条 */
.mat-lib-full-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 12px 20px 12px 28px;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.mat-lib-full-grid::-webkit-scrollbar {
    width: 5px;
}
.mat-lib-full-grid::-webkit-scrollbar-track {
    background: transparent;
}
.mat-lib-full-grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
}

.mat-lib-full-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
}

.mat-lib-full-item:hover { border-color: rgba(79,110,246,0.3); }

/* 已添加状态 */
.mat-lib-full-item.already-added {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: rgba(74,222,128,0.2);
    background: rgba(74,222,128,0.03);
}

.mat-lib-full-item.already-added:hover {
    border-color: rgba(74,222,128,0.35);
    opacity: 0.55;
}

.mat-lib-added-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    color: #4ade80;
    font-size: 0.9rem;
    font-weight: 700;
    z-index: 3;
    pointer-events: none;
}

/* 抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.mat-lib-full-item.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(79,110,246,0.15);
}

.mat-lib-full-thumb {
    aspect-ratio: 16/10;
    background: #0a0a18;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; font-size: 2rem;
    position: relative;
}

.mat-lib-full-thumb img, .mat-lib-full-thumb video {
    width: 100%; height: 100%; object-fit: cover;
}

.mat-card-type-badge {
    position: absolute; top: 6px; left: 6px;
    padding: 2px 7px; border-radius: 4px;
    font-size: 0.62rem; font-weight: 600; color: #fff; z-index: 2;
}
.mat-card-type-badge.image { background: rgba(79,110,246,0.7); }
.mat-card-type-badge.video { background: rgba(168,85,247,0.7); }
.mat-card-type-badge.audio { background: rgba(234,179,8,0.7); }

.mat-lib-full-name {
    padding: 8px 10px; font-size: 0.74rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 底部 */
.mat-lib-full-footer {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    background: #15152a;
}

#matLibSelectedHint {
    font-size: 0.82rem; color: #a0a0c0;
    margin-right: auto;
}

/* 弹窗内筛选按钮(复用素材页) */
.mat-filter-btn {
    padding: 7px 14px; background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06); border-radius: 20px;
    color: #a0a0c0; font-size: 0.82rem; cursor: pointer;
    font-family: var(--font-family); white-space: nowrap;
    display: flex; align-items: center; gap: 5px;
    transition: all var(--transition);
}
.mat-filter-btn:hover { border-color: rgba(79,110,246,0.3); color: #fff; }
.mat-filter-btn.active-filter { border-color: var(--color-primary); background: rgba(79,110,246,0.08); color: var(--color-primary-light); }

/* 弹窗内下拉菜单 */
.mat-dropdown {
    position: fixed; background: #15152a;
    border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
    padding: 4px; z-index: 910; min-width: 150px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.5);
}
.mat-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 6px;
    font-size: 0.82rem; color: #a0a0c0; cursor: pointer;
    border: none; background: transparent; width: 100%; text-align: left;
    font-family: var(--font-family); transition: all var(--transition);
}
.mat-dropdown-item:hover { background: rgba(255,255,255,0.04); color: #fff; }

/* 弹窗内分类标签(复用) */
.mat-cat-btn {
    padding: 7px 16px; background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05); border-radius: 20px;
    color: #a0a0c0; font-size: 0.82rem; cursor: pointer;
    font-family: var(--font-family); white-space: nowrap; flex-shrink: 0;
    transition: all var(--transition);
}
.mat-cat-btn:hover { border-color: rgba(79,110,246,0.3); color: #fff; }
.mat-cat-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.mat-cat-btn .count { font-size: 0.7rem; opacity: 0.7; margin-left: 3px; }

.mat-search {
    position: relative; display: flex; align-items: center;
}
.mat-search-icon {
    position: absolute; left: 10px; font-size: 0.85rem; color: #6b6b8a; pointer-events: none;
}
.mat-search-input {
    padding: 8px 14px 8px 34px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px; color: #fff;
    font-size: 0.84rem; font-family: var(--font-family); outline: none;
    transition: border-color var(--transition);
}
.mat-search-input:focus { border-color: var(--color-primary); }

@media (max-width: 768px) {
    .mat-lib-full-grid { grid-template-columns: repeat(2, 1fr); }
    .mat-lib-full-toolbar { flex-wrap: wrap; }
}

/* ============================================
   灵感弹窗
   ============================================ */
.inspire-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.inspire-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.inspire-modal {
    background: #15152a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    width: 760px;
    max-width: 95vw;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

/* 弹窗头部 */
.inspire-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.inspire-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inspire-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.inspire-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* 分类标签横排（可左右滑动） */
.inspire-cat-tabs-wrap {
    position: relative;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.inspire-cat-tabs-scroll {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 16px;
    gap: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.inspire-cat-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.inspire-cat-tab {
    flex-shrink: 0;
    padding: 9px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    font-size: 0.84rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    white-space: nowrap;
}

.inspire-cat-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.inspire-cat-tab.active {
    background: rgba(79, 110, 246, 0.15);
    border-color: var(--color-primary);
    color: var(--color-primary-light);
}

/* 左右滑动箭头 */
.inspire-cat-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(21, 21, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all var(--transition);
}

.inspire-cat-arrow:hover {
    background: rgba(21, 21, 42, 1);
    color: var(--text-primary);
}

.inspire-cat-arrow-left {
    left: 4px;
}

.inspire-cat-arrow-right {
    right: 4px;
}

/* 关键词列表区（竖向可滚动） */
.inspire-keywords-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    min-height: 180px;
    max-height: 350px;
}

.inspire-keywords-group {
    margin-bottom: 16px;
}

.inspire-keywords-group:last-child {
    margin-bottom: 0;
}

.inspire-keywords-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-left: 2px;
}

.inspire-keywords-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inspire-keyword {
    padding: 7px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    white-space: nowrap;
}

.inspire-keyword:hover {
    background: rgba(79, 110, 246, 0.1);
    border-color: rgba(79, 110, 246, 0.25);
    color: var(--color-primary-light);
}

.inspire-keyword.selected {
    background: rgba(79, 110, 246, 0.18);
    border-color: var(--color-primary);
    color: var(--color-primary-light);
}

/* 灵感按钮 */
.inspire-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: var(--radius-full);
    color: var(--color-accent-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    margin-top: 10px;
}

.inspire-btn:hover {
    background: rgba(168, 85, 247, 0.18);
    border-color: rgba(168, 85, 247, 0.35);
}

/* 已选关键词预览条 */
.inspire-selected-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    min-height: 20px;
    align-items: center;
}

.inspire-selected-chip {
    padding: 4px 10px;
    background: rgba(79, 110, 246, 0.1);
    border: 1px solid rgba(79, 110, 246, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    color: var(--color-primary-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

.inspire-selected-remove {
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.7;
}

.inspire-selected-remove:hover {
    opacity: 1;
}

/* 弹窗底部按钮 */
.inspire-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.inspire-selected-count {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.inspire-selected-count span {
    color: var(--color-primary-light);
    font-weight: 500;
}

.inspire-actions {
    display: flex;
    gap: 10px;
}

.inspire-btn-clear {
    padding: 8px 18px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.84rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
}

.inspire-btn-clear:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.inspire-btn-apply {
    padding: 8px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
}

.inspire-btn-apply:hover {
    box-shadow: 0 4px 16px rgba(79, 110, 246, 0.35);
}

/* --- 保留尾图选项 --- */
.keep-tail-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 12px;
    user-select: none;
}

.keep-tail-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.keep-tail-check {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    font-size: 0.7rem;
    color: transparent;
}

.keep-tail-toggle.checked .keep-tail-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.keep-tail-label {
    font-size: 0.84rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.keep-tail-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ============================================
   结果卡片 + 灯箱 + @素材
   ============================================ */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
    cursor: pointer;
}
.result-card:hover { border-color: rgba(79,110,246,0.3); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

.result-card-thumb {
    aspect-ratio: 16/10;
    background: #0a0a18;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
}
.result-thumb-media { width: 100%; height: 100%; object-fit: cover; }
.result-play-icon {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3); font-size: 2rem; color: #fff; opacity: 0; transition: opacity var(--transition);
}
.result-card-thumb:hover .result-play-icon { opacity: 1; }

.result-card-body { padding: 10px 12px; }
.result-card-prompt { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.result-card-time { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 8px; }
.result-copy-btn { width: 22px; height: 22px; border-radius: 4px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.65rem; flex-shrink: 0; opacity: 0; transition: all var(--transition); }
.result-card:hover .result-copy-btn { opacity: 1; }
.result-copy-btn:hover { background: rgba(79,110,246,0.12); color: var(--color-primary-light); }

.result-card-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.result-act-btn {
    padding: 4px 10px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px; color: var(--text-muted); font-size: 0.72rem; cursor: pointer;
    font-family: var(--font-family); transition: all var(--transition); white-space: nowrap;
}
.result-act-btn:hover { background: rgba(79,110,246,0.1); border-color: rgba(79,110,246,0.2); color: var(--color-primary-light); }

/* 灯箱 */
.result-lightbox { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.result-lightbox-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.85); }
.result-lightbox-img { position: relative; max-width: 90vw; max-height: 90vh; border-radius: 8px; z-index: 1; }
.result-lightbox-video { position: relative; max-width: 90vw; max-height: 90vh; z-index: 1; }
.result-lightbox-close { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,0.6); border: none; color: #fff; font-size: 1.2rem; cursor: pointer; z-index: 2; display: flex; align-items: center; justify-content: center; }
.result-lightbox-close:hover { background: rgba(239,68,68,0.7); }

/* ============================================
   @素材下拉 — 重写版
   ============================================ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.result-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-card-loading { opacity: 0.7; }
.result-card-error { border-color: rgba(239,68,68,0.2); }

/* @素材下拉容器 */
.at-mention-dropdown {
    position: fixed;
    background: #15152a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: 500;
    min-width: 320px;
    max-height: 420px;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    display: none;
    animation: fadeInUp 0.2s ease;
}
/* 搜索框 */
.at-dd-search { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); flex-shrink: 0; }
.at-dd-search-input {
    width: 100%; padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px; color: #fff; font-size: 0.84rem;
    font-family: inherit; outline: none;
    transition: border-color 0.2s;
}
.at-dd-search-input:focus { border-color: var(--color-primary); }
.at-dd-search-input::placeholder { color: #6b6b8a; }

/* 素材列表 */
.at-dd-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.at-dd-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px; cursor: pointer;
    transition: all 0.15s;
}
.at-dd-item:hover { background: rgba(79, 110, 246, 0.08); }

.at-dd-item-thumb {
    width: 44px; height: 44px; border-radius: 6px;
    overflow: hidden; flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
    display: flex; align-items: center; justify-content: center;
}
.at-dd-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.at-dd-thumb-icon { font-size: 1.3rem; }
.at-dd-item-info { flex: 1; min-width: 0; }
.at-dd-item-name { font-size: 0.84rem; font-weight: 500; color: #e0e0f0; }
.at-dd-item-type { font-size: 0.7rem; color: #6b6b8a; margin-top: 1px; }

/* 空态 */
.at-dd-empty { padding: 20px; text-align: center; color: #6b6b8a; font-size: 0.82rem; }

/* 底栏 */
.at-dd-footer { padding: 8px 12px; border-top: 1px solid rgba(255,255,255,0.05); flex-shrink: 0; }
.at-dd-add-btn {
    width: 100%; padding: 9px; background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 8px;
    color: #a0a0c0; font-size: 0.84rem; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
}
.at-dd-add-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* 来源按钮面板 */
.at-dd-source-panel {
    display: flex; flex-direction: column; gap: 6px;
    padding: 8px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}
.at-dd-source-visible { display: flex !important; }

.at-dd-source-btn {
    padding: 12px 16px; background: rgba(79, 110, 246, 0.06);
    border: 1px solid rgba(79, 110, 246, 0.12); border-radius: 8px;
    color: #c0c0e0; font-size: 0.88rem; cursor: pointer;
    font-family: inherit; text-align: left; transition: all 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.at-dd-source-btn:hover {
    background: rgba(79, 110, 246, 0.14);
    border-color: rgba(79, 110, 246, 0.3);
    color: #fff;
}

/* 悬停放大预览 */
.at-dd-preview {
    position: fixed; z-index: 9999;
    width: 280px; max-height: 240px;
    background: #15152a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}
.at-dd-preview img,
.at-dd-preview video {
    width: 100%; height: auto; max-height: 240px;
    object-fit: contain; background: #0a0a18;
}

/* ============================================
   @素材芯片 — 色彩区分 + 悬停预览
   ============================================ */
.at-chip-area {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px; padding: 0 2px;
    min-height: 0;
}
.at-chip-area:empty { display: none; }

.at-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 8px 4px 6px;
    border-radius: 6px; font-size: 0.76rem;
    cursor: default; position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
}
.at-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* 图片 chip — 紫色 */
.at-chip.image {
    background: rgba(79, 110, 246, 0.1);
    border: 1px solid rgba(79, 110, 246, 0.22);
    color: #a5b4fc;
}
.at-chip.image:hover { background: rgba(79, 110, 246, 0.18); border-color: rgba(79, 110, 246, 0.4); }

/* 视频 chip — 青色 */
.at-chip.video {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.22);
    color: #67e8f9;
}
.at-chip.video:hover { background: rgba(6, 182, 212, 0.18); border-color: rgba(6, 182, 212, 0.4); }

/* 音频 chip — 橙色 */
.at-chip.audio {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.22);
    color: #fbbf24;
}
.at-chip.audio:hover { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.4); }

.at-chip-icon { font-size: 0.85rem; }
.at-chip-thumb {
    width: 18px; height: 18px; border-radius: 3px;
    object-fit: cover; flex-shrink: 0;
}
.at-chip-name { font-weight: 500; }

.at-chip-remove {
    width: 16px; height: 16px; border-radius: 50%;
    background: rgba(0, 0, 0, 0.3); border: none;
    color: #fff; font-size: 0.55rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    margin-left: 1px; opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}
.at-chip:hover .at-chip-remove { opacity: 1; }
.at-chip-remove:hover { background: #ef4444; }

/* 芯片悬停预览 */
.at-chip-preview {
    position: fixed; z-index: 9999;
    width: 280px; max-height: 240px;
    background: #15152a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    animation: fadeInUp 0.15s ease;
}
.at-chip-preview img,
.at-chip-preview video {
    width: 100%; height: auto; max-height: 240px;
    object-fit: contain; background: #0a0a18;
}
