/* ==========================================================================
   AI Studio - 高级极简精致深色工作台样式 (Refined & Compact Edition)
   ========================================================================== */

:root {
    --bg-main: #090c13;
    --bg-card: rgba(15, 20, 32, 0.7);
    --bg-card-hover: rgba(20, 27, 44, 0.85);
    --bg-input: rgba(11, 15, 25, 0.9);
    
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-active: rgba(99, 102, 241, 0.5);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #8b5cf6;
    --accent-cyan: #06b6d4;
    --success: #10b981;
    --danger: #ef4444;
    
    --text-main: #f1f5f9;
    --text-muted: #8492a6;
    --text-dim: #505d74;
    
    --radius-xs: 5px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    
    --transition-smooth: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 渐变微光氛围背景 */
.app-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.15;
}

.glow-1 {
    top: -120px;
    left: -100px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #6366f1, #8b5cf6, transparent 70%);
}

.glow-2 {
    bottom: -150px;
    right: -100px;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, #06b6d4, #3b82f6, transparent 70%);
}

/* 顶部紧凑导航 Header */
.app-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(9, 12, 19, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-shrink: 0;
}

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

.logo-badge {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.brand-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 400;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 4px 10px;
    border-radius: 9999px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulseGlow 2s infinite ease-in-out;
}

.status-text {
    font-size: 0.72rem;
    color: #34d399;
    font-weight: 500;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* ==========================================================================
   主工作台双栏 Layout (严格固定高度 + 独立滚动)
   ========================================================================== */
.workbench-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    height: calc(100vh - 56px);
    overflow: hidden;
    width: 100%;
}

/* 左侧控制栏 */
.panel-control {
    background: rgba(12, 16, 26, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* 左侧真正的滚动容器 (必须 flex: 1; min-height: 0; overflow-y: auto) */
.panel-scroll-inner {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 18px 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 精致滚动条 */
.panel-scroll-inner::-webkit-scrollbar,
.preview-scroll-inner::-webkit-scrollbar {
    width: 5px;
}
.panel-scroll-inner::-webkit-scrollbar-thumb,
.preview-scroll-inner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.panel-scroll-inner::-webkit-scrollbar-thumb:hover,
.preview-scroll-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* 模式切换卡片 */
.mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--bg-input);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 500;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mode-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.3));
    color: #fff;
    border: 1px solid rgba(99, 102, 241, 0.45);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 通用精致分区卡片 */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 13px 14px;
    transition: var(--transition-smooth);
}

.section-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

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

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.section-desc {
    font-size: 0.68rem;
    color: var(--text-dim);
}

.section-badge {
    font-size: 0.68rem;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

/* 提示词输入 */
.prompt-input-box textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-main);
    font-size: 0.82rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    max-height: 220px;
    outline: none;
    transition: var(--transition-smooth);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.prompt-input-box textarea:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

/* 提示词专属超细精致滚动条 */
.prompt-input-box textarea::-webkit-scrollbar {
    width: 4px;
}

.prompt-input-box textarea::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.prompt-input-box textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.prompt-input-box textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

/* 灵感快捷 Tags */
.prompt-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

.tag-label {
    font-size: 0.68rem;
    color: var(--text-dim);
}

.prompt-tag {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 9999px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.prompt-tag:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
    color: #fff;
}

/* 参考图上传 Dropzone */
.file-input-hidden {
    display: none;
}

.upload-dropzone {
    border: 1.5px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-input);
    transition: var(--transition-smooth);
    position: relative;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px auto;
    color: var(--primary);
}

.dropzone-primary-text {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 2px;
}

.dropzone-secondary-text {
    font-size: 0.66rem;
    color: var(--text-dim);
}

.upload-preview-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    position: relative;
}

.upload-preview-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-subtle);
}

.upload-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}

.upload-filename {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-filesize {
    font-size: 0.68rem;
    color: var(--text-dim);
}

.btn-remove-upload {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-remove-upload:hover {
    background: var(--danger);
    color: #fff;
}

/* 历史参考图素材库 */
.ref-history-box {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.ref-history-title {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-dim);
}

.ref-history-count {
    font-size: 0.65rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 1px 6px;
    border-radius: 9999px;
}

.ref-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
    max-height: 125px;
    overflow-y: auto;
    padding: 2px;
}

.ref-thumb-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-xs);
    overflow: hidden;
    cursor: pointer;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-input);
    transition: var(--transition-smooth);
}

.ref-thumb-item:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.25);
}

.ref-thumb-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.45);
}

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

/* 参考图微型删除按钮 */
.btn-ref-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: rgba(10, 13, 20, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: 2;
}

.ref-thumb-item:hover .btn-ref-delete {
    opacity: 1;
}

.btn-ref-delete:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* 比例与画幅胶囊按钮 (精致紧凑版) */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.ratio-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 4px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-muted);
}

.ratio-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.ratio-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.18);
}

.ratio-box {
    border: 1px solid currentColor;
    border-radius: 2px;
    display: inline-block;
}

.ratio-1-1 { width: 14px; height: 14px; }
.ratio-3-2 { width: 17px; height: 12px; }
.ratio-2-3 { width: 12px; height: 17px; }
.ratio-16-9 { width: 18px; height: 11px; }
.ratio-9-16 { width: 11px; height: 18px; }

.ratio-text {
    font-size: 0.72rem;
    font-weight: 600;
}

.ratio-sub {
    font-size: 0.62rem;
    color: var(--text-dim);
}

/* 参数选择行 */
.params-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.param-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.param-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
}

.select-wrapper select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 7px 9px;
    color: var(--text-main);
    font-size: 0.76rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.select-wrapper select:focus {
    border-color: var(--primary);
}

/* 精致高级的生成主按钮 */
.action-footer {
    margin-top: 4px;
    padding-bottom: 8px;
}

.btn-generate {
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #4f46e5 100%);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: var(--transition-smooth);
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

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

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

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-20deg);
    animation: shineAnim 4s infinite linear;
}

@keyframes shineAnim {
    0% { left: -100%; }
    25%, 100% { left: 200%; }
}

/* ==========================================================================
   右侧展示与画布工作区 (永远不被挤压变形)
   ========================================================================== */
.panel-preview {
    background: rgba(8, 11, 18, 0.5);
    height: 100%;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-scroll-inner {
    padding: 20px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 主展示卡片 */
.showcase-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    position: relative;
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* 空状态 */
.empty-state {
    text-align: center;
    max-width: 380px;
    padding: 40px 16px;
    margin: auto;
}

.empty-icon-orb {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.12));
    border: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    color: var(--primary);
}

.empty-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.empty-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 18px;
}

/* 加载动画状态 */
.loading-state {
    text-align: center;
    padding: 50px 16px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-spinner-box {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    position: absolute;
    border-radius: 50%;
}

.ring-outer {
    width: 100%;
    height: 100%;
    border: 2.5px solid transparent;
    border-top-color: var(--primary);
    border-right-color: var(--accent);
    animation: spinClockwise 1.4s linear infinite;
}

.ring-inner {
    width: 60%;
    height: 60%;
    border: 2px solid transparent;
    border-bottom-color: var(--accent-cyan);
    animation: spinCounterClockwise 1s linear infinite;
}

.spinner-center-icon {
    color: #fff;
    animation: pulseGlow 1.5s infinite ease-in-out;
}

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

@keyframes spinCounterClockwise {
    100% { transform: rotate(-360deg); }
}

.loading-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
}

.loading-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.timer-badge {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--accent-cyan);
    padding: 3px 12px;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 600;
}

/* ==========================================================================
   生成结果状态 (预览框下方专属操作栏：文件名居左，按钮居右)
   ========================================================================== */
.result-state {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    min-width: 0;
}

/* 居中视窗舞台 (预览框) */
.result-stage {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(5, 7, 12, 0.7);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    padding: 18px;
    overflow: hidden;
    box-sizing: border-box;
    min-height: 280px;
}

.image-stage-box {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.main-result-img {
    max-width: 100%;
    max-height: 480px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    transition: var(--transition-smooth);
    display: block;
}

/* 预览框正下方的底栏 (文件名居左，操作按钮居右) */
.result-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(14, 18, 30, 0.75);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    width: 100%;
    box-sizing: border-box;
}

.bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.file-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.76rem;
    min-width: 0;
    overflow: hidden;
}

.result-filename-label {
    color: var(--text-main);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size-tag {
    font-size: 0.68rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid var(--border-subtle);
}

.bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 极简幽灵按钮 (全屏查看、复制链接) */
.btn-action-ghost {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 0.73rem;
    font-weight: 500;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-action-ghost:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.16);
    color: #fff;
}

/* 高雅强调按钮 (下载原图) */
.btn-action-solid {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #fff;
    font-size: 0.73rem;
    font-weight: 600;
    border-radius: var(--radius-xs);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    transition: var(--transition-smooth);
}

.btn-action-solid:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

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

/* 图像元信息面板 */
.result-metadata-card {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.meta-row {
    display: flex;
    gap: 6px;
    font-size: 0.78rem;
    min-width: 0;
    width: 100%;
}

.meta-label {
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.meta-prompt-text {
    color: var(--text-main);
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}

.meta-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.meta-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 4px;
}

/* ==========================================================================
   底部历史图库画廊 (紧凑精致)
   ========================================================================== */
.history-gallery-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.gallery-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.gallery-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
}

.gallery-count-badge {
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 9999px;
    color: var(--text-muted);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.history-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
    aspect-ratio: 1 / 1;
}

.history-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

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

.history-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(9, 12, 19, 0.92) 0%, transparent 60%);
    opacity: 0;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 8px;
}

.history-card:hover .history-card-overlay {
    opacity: 1;
}

.history-card-prompt {
    font-size: 0.68rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.history-card-date {
    font-size: 0.6rem;
    color: var(--text-dim);
}

/* 历史卡片右上角微删除按钮 */
.btn-card-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xs);
    background: rgba(14, 18, 30, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
    transition: var(--transition-smooth);
    z-index: 5;
}

.history-card:hover .btn-card-delete {
    opacity: 1;
    transform: scale(1);
}

.btn-card-delete:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgba(239, 68, 68, 1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   二次确认删除 Modal
   ========================================================================== */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.2s ease-out;
}

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 12, 0.85);
    backdrop-filter: blur(10px);
}

.confirm-card {
    position: relative;
    z-index: 100001;
    background: rgba(18, 24, 38, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.confirm-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.confirm-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.confirm-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 8px;
}

.confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.btn-modal-cancel {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.btn-modal-danger {
    padding: 8px 14px;
    background: #ef4444;
    border: 1px solid transparent;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
}

.btn-modal-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   全屏灯箱 Modal
   ========================================================================== */
.lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 12, 0.9);
    backdrop-filter: blur(12px);
}

.lightbox-content {
    position: relative;
    z-index: 10000;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
}

.lightbox-close-btn {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.lightbox-close-btn:hover {
    background: var(--danger);
}

/* ==========================================================================
   Toast 消息通知
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(14, 18, 30, 0.95);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.78rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition-smooth);
}

.toast.toast-success {
    border-color: rgba(16, 185, 129, 0.4);
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, 0.4);
}

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

.hidden {
    display: none !important;
}

/* 响应式调整 */
@media (max-width: 960px) {
    body {
        height: auto;
        overflow-y: auto;
    }
    .workbench-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    .panel-control {
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    .panel-preview {
        height: auto;
    }
}
