:root {
    --bg-primary: #111111;
    --bg-secondary: #1a1a1a;
    --bg-card: #222222;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent-gold: #ffd700;
    --accent-gold-dim: rgba(255, 215, 0, 0.1);
    --border-color: #333333;
    --success-color: #4caf50;
    --error-color: #f44336;
}

/* ================= SVG 连线层 ================= */
#connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.connection-line {
    stroke: var(--accent-gold);
    stroke-width: 2px;
    fill: none;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
    transition: stroke 0.2s, stroke-width 0.2s;
}

/* 🔧 连线交互样式 */
.connection-group:hover .connection-line {
    stroke: #ef4444;
    stroke-width: 3px;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
}

.connection-hit-area {
    cursor: pointer;
}

.connection-delete-btn {
    pointer-events: all;
    cursor: pointer;
}

.connection-delete-btn circle {
    transition: transform 0.2s, fill 0.2s;
}

.connection-delete-btn:hover circle {
    fill: #dc2626;
    transform: scale(1.1);
}

/* 临时连线动画 */
.temp-connection {
    stroke: #22d3ee !important;
    stroke-dasharray: 8, 4;
    animation: dash 0.5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -12;
    }
}

/* 输出连接点样式 */
.output-handle {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--accent-gold);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    cursor: crosshair;
    z-index: 10;
    transition: all 0.2s;
}

.output-handle:hover {
    transform: translateY(-50%) scale(1.3);
    box-shadow: 0 0 10px var(--accent-gold);
}

/* ================= Context Menu (右键/长按菜单) ================= */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 10000;
    min-width: 180px;
    padding: 8px 0;
    animation: contextMenuFadeIn 0.15s ease;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu .menu-item {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu .menu-item:hover {
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
}

.context-menu .menu-item:active {
    background: rgba(255, 215, 0, 0.2);
    transform: scale(0.98);
}

/* ================= 📱 移动端全面优化 ================= */

/* 🔧 移动端触摸优化 */
/* 只对画布内部禁用默认触摸，其他区域保持正常 */
.canvas-inner {
    touch-action: none;
}

/* 侧边栏可滚动 */
.sidebar {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto !important;
}

/* 📱 移动端修复 */
@media (max-width: 768px) {
    html, body {
        height: auto !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow: auto !important;
        touch-action: pan-x pan-y pinch-zoom !important;
    }
    
    .app-container {
        height: auto !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        touch-action: pan-x pan-y pinch-zoom !important;
    }
    
    .sidebar {
        height: auto !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        touch-action: pan-x pan-y !important;
    }
    
    .main-content {
        height: auto !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        touch-action: pan-x pan-y pinch-zoom !important;
    }
    
    /* 画布内部单独处理 */
    .canvas-container {
        touch-action: none !important;
    }
}

/* 移动端菜单按钮默认隐藏 */
.mobile-menu-btn {
    display: none;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
}

/* 桌面端禁止滚动 */
@media (min-width: 769px) {
    body {
        overflow: hidden;
    }
}

/* 📱 移动端样式已在上方统一媒体查询中定义 */

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ================= Sidebar ================= */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
    color: var(--accent-gold);
}

/* 用户状态栏 */
.user-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.user-login-btn:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 20px;
    color: var(--accent-gold);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s ease;
}

.user-avatar-btn:hover {
    background: rgba(251, 191, 36, 0.2);
}

.user-avatar-small {
    width: 24px;
    height: 24px;
    background: var(--accent-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 12px;
    font-weight: 600;
}

.user-quota-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 10px;
    font-size: 11px;
    color: var(--accent-gold);
}

.brand-icon {
    width: 24px;
    height: 24px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 强制开启硬件加速滚动 */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    /* 防止横向滚动 */
    overflow-x: hidden;
}

/* 模式切换 */
.mode-toggle {
    display: flex;
    background: #222;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.mode-toggle label {
    flex: 1;
    text-align: center;
    padding: 6px 0;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
}

.mode-toggle input {
    display: none;
}

.mode-toggle label:has(input:checked) {
    background: #333;
    color: var(--accent-gold);
    font-weight: 500;
}

/* 模式说明浮窗 */
.mode-label[data-tooltip] {
    position: relative;
}

.mode-label[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.95);
    color: #e0e0e0;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-line;
    min-width: 220px;
    max-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(212, 175, 55, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1000;
    pointer-events: none;
    text-align: left;
}

.mode-label[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(20, 20, 30, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1001;
}

.mode-label[data-tooltip]:hover::after,
.mode-label[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* 并发控制 */
.task-limit-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #222;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    color: #ccc;
}

.limit-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.limit-input button {
    width: 24px;
    height: 24px;
    border: 1px solid #444;
    background: #333;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.limit-input button:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* 快速输入区 */
.quick-input-section {
    background: #222;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #333;
}

.section-title {
    font-size: 14px;
    color: var(--accent-gold);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-textarea {
    width: 100%;
    height: 80px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    padding: 10px;
    font-size: 13px;
    resize: none;
    margin-bottom: 10px;
}
.quick-textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.voice-btn {
    width: 100%;
    padding: 8px;
    background: #333;
    border: 1px dashed #555;
    color: #aaa;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 5px;
    transition: all 0.3s;
}
.voice-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}
.voice-btn.recording {
    background: rgba(244, 67, 54, 0.1);
    border-color: #f44336;
    color: #f44336;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.voice-status {
    font-size: 10px;
    color: #666;
    text-align: center;
    margin-bottom: 10px;
    height: 14px;
}
.voice-status.active {
    color: var(--accent-gold);
}

.voice-commands-hint {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 11px;
    color: #888;
}
.commands-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.quick-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}
.option-row {
    display: flex;
    gap: 10px;
}
.option-group {
    flex: 1;
}
.option-group label {
    display: block;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}
.option-group select, .option-group input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}

/* 🔧 修复下拉框选项颜色 */
.option-group select option {
    background: #1a1a1a;
    color: #fff;
    padding: 8px;
}

.btn-add-task {
    width: 100%;
    padding: 10px;
    background: var(--accent-gold);
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 13px;
}
.btn-add-task:hover {
    background: #e6c200;
}

/* 任务队列 */
.tasks-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}
.tasks-section .section-title {
    justify-content: space-between;
    color: #888;
}
.btn-icon {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
}
.btn-icon:hover {
    color: #fff;
}

.ideas-list {
    flex: 1;
    overflow-y: auto;
    background: #151515;
    border-radius: 6px;
    padding: 8px;
    border: 1px solid #2a2a2a;
}

.idea-item {
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.idea-item:hover {
    border-color: #555;
}
.idea-item .item-checkbox {
    flex-shrink: 0;
}
.idea-item .item-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.idea-item .item-theme {
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.idea-item .item-status {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}
/* 任务项操作按钮容器 */
.idea-item .item-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.idea-item:hover .item-actions {
    opacity: 1;
}

/* 任务设置按钮 */
.btn-task-settings {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid #444 !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #fff;
    transition: all 0.2s;
    z-index: 10;
    position: relative;
}
.btn-task-settings:hover {
    background: rgba(251, 191, 36, 0.3) !important;
    border-color: var(--accent-gold) !important;
    transform: scale(1.1);
}

/* 单独删除按钮 */
.idea-delete-btn {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    cursor: pointer !important;
    color: #ef4444 !important;
    font-size: 12px !important;
    transition: all 0.2s;
    z-index: 10;
    position: relative;
}
.idea-delete-btn:hover {
    background: rgba(239, 68, 68, 0.5) !important;
    transform: scale(1.1);
}
.btn-task-settings:hover {
    opacity: 1;
    transform: scale(1.2);
}
.idea-item.selected {
    border-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.05);
}
.idea-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.idea-number {
    font-size: 10px;
    color: #666;
    font-weight: bold;
}
.idea-remove {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}
.idea-remove:hover {
    color: #f44336;
}
.idea-theme {
    font-size: 13px;
    color: #fff;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.idea-meta {
    display: flex;
    gap: 6px;
}
.meta-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: #333;
    border-radius: 4px;
    color: #aaa;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-primary-large {
    width: 100%;
    padding: 12px;
    background: var(--accent-gold);
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-primary-large:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}
.btn-primary-large:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary-large {
    width: 100%;
    padding: 8px;
    background: #333;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-secondary-large:hover {
    background: #444;
    color: #fff;
}

.quota-info {
    font-size: 12px;
    color: #888;
    text-align: center;
    margin-bottom: 5px;
}

.footer-links {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}
.btn-link {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
}
.btn-link:hover {
    color: var(--accent-gold);
}

.copyright {
    text-align: center;
    font-size: 10px;
    color: #444;
    margin-top: 10px;
}

/* ================= Main Content ================= */
.content-area {
    flex: 1;
    background: #111;
    display: flex;
    flex-direction: column;
    position: relative;
}

.top-bar {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--bg-secondary);
    z-index: 9;
}
.btn-back {
    background: none;
    border: 1px solid #444;
    color: #ccc;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.btn-back:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}
.top-bar-right {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #888;
}
.status-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-gold);
}
.status-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-gold);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-gold);
}

/* 进度统计仪表盘 */
.progress-dashboard {
    background: #151515;
    border-bottom: 1px solid #333;
    padding: 15px 20px;
}
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.dashboard-title {
    font-size: 16px;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-back-icon {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
}
.btn-back-icon:hover { color: #fff; }

.filter-group {
    display: flex;
    align-items: center;
}
.checkbox-label {
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-filters {
    display: flex;
    gap: 10px;
}
.status-filter {
    background: #222;
    border: 1px solid #333;
    color: #888;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}
.status-filter.success { color: var(--success-color); border-color: rgba(76, 175, 80, 0.3); }
.status-filter.processing { color: #2196F3; border-color: rgba(33, 150, 243, 0.3); }
.status-filter.failed { color: var(--error-color); border-color: rgba(244, 67, 54, 0.3); }

.progress-track {
    display: flex;
    align-items: center;
    gap: 15px;
}
.progress-info {
    font-size: 12px;
    color: #888;
    min-width: 100px;
}
.progress-bar-bg {
    flex: 1;
    height: 6px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold), #ff9800);
    width: 0%;
    transition: width 0.3s ease;
}

/* 无限画布区域 */
.canvas-container {
    flex: 1;
    overflow: hidden; /* 隐藏溢出，通过拖拽平移 */
    position: relative;
    background-image: radial-gradient(#222 1px, transparent 1px);
    background-size: 20px 20px;
    cursor: grab;
}
.canvas-container:active {
    cursor: grabbing;
}

/* 无限画布内容区域（真正的无限画布，无尺寸限制） */
#taskCanvas {
    position: relative;
    transform-origin: 0 0;
    /* 不设置 min-width/min-height，内容自动扩展 */
}

.canvas-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border: 1px solid #333;
    border-radius: 6px;
    display: flex;
    align-items: center;
    z-index: 100;
}
.canvas-controls button {
    background: none;
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
}
.canvas-controls button:hover {
    color: var(--accent-gold);
}
.zoom-level {
    font-size: 12px;
    color: #888;
    padding: 0 8px;
    border-right: 1px solid #444;
}

/* 🆕 节点工具栏 */
.node-toolbar {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid #444;
    border-radius: 12px;
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.node-tool-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.node-tool-btn:hover {
    background: linear-gradient(135deg, var(--accent-gold), #ffce5a);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(251,191,36,0.3);
}
.node-tool-btn:active {
    transform: scale(0.95);
}

.infinite-canvas {
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    display: flex;
    padding: 50px;
    box-sizing: content-box; /* 避免padding影响宽高计算 */
}

.cards-grid {
    display: flex;
    gap: 30px;
    /* flex-wrap: wrap; // 不换行，水平排列 */
    align-items: flex-start;
}

/* 任务卡片 (右侧显示) */
.task-card, .detailed-flow-container {
    width: 400px;
    min-width: 320px;
    min-height: 200px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all 0.3s;
    resize: both;
    overflow: auto;
}
.task-card:hover {
    border-color: #555;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.task-card.processing {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.1);
}
.task-card.selected {
    border: 1px solid var(--accent-gold);
    background: rgba(255, 215, 0, 0.05);
}

.task-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
}

.task-title {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
    padding-right: 40px;
}
.task-status {
    font-size: 12px;
    color: #888;
    margin-bottom: 15px;
}
.task-select {
    margin-bottom: 10px;
}
.task-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-gold);
}

.task-steps {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.step-item {
    font-size: 12px;
    color: #666;
    padding: 4px 8px;
    background: #1a1a1a;
    border-radius: 4px;
    border-left: 2px solid #333;
}
.step-item.processing {
    color: #fff;
    border-left-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.05);
    animation: pulse-gold 2s infinite;
}
.step-item.completed {
    color: #aaa;
    border-left-color: var(--success-color);
}
.step-item.failed {
    color: var(--error-color);
    border-left-color: var(--error-color);
}
@keyframes pulse-gold {
    0% { background: rgba(255, 215, 0, 0.05); }
    50% { background: rgba(255, 215, 0, 0.15); }
    100% { background: rgba(255, 215, 0, 0.05); }
}

/* 结果卡片 */
.result-card {
    width: 450px; /* 稍微加宽 */
    background: #222;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 0;
    flex-shrink: 0;
    overflow: hidden;
    resize: both;
}
.result-card-header {
    padding: 15px 20px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.result-title {
    font-size: 14px;
    color: #fff;
    font-weight: 600;
}
.btn-download {
    font-size: 12px;
    padding: 4px 8px;
    background: #333;
    border: 1px solid #444;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
}
.btn-download:hover { color: #fff; border-color: #666; }

/* 思维导图节点样式 */
.mind-node {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}
.mind-node-title {
    font-size: 13px;
    font-weight: bold;
    color: #ccc;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mind-node-content {
    font-size: 12px;
    color: #888;
}
.mind-sub-node {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 8px;
    margin-top: 8px;
}

.result-sections {
    padding: 15px;
}
.result-section {
    margin-bottom: 15px;
}
.section-label {
    font-size: 12px;
    color: var(--accent-gold);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.section-content {
    font-size: 12px;
    color: #ccc;
    line-height: 1.5;
    background: #1a1a1a;
    padding: 10px;
    border-radius: 6px;
    white-space: pre-wrap;
}

/* 光影时刻 Overlay */
.creative-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.5s ease;
}
.creative-overlay.active {
    opacity: 1;
}
.creative-content {
    text-align: center;
}
.creative-text {
    font-size: 24px;
    color: var(--accent-gold);
    margin-bottom: 20px;
    font-family: 'Times New Roman', serif;
    letter-spacing: 1px;
}
.creative-overlay button {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}
.creative-overlay button:hover {
    border-color: #fff;
    color: #fff;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* flex when active */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: modalSlideIn 0.3s ease-out;
}
@keyframes modalSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
}
.btn-close {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
}
.btn-close:hover { color: #fff; }

.modal-body {
    padding: 20px;
}
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 🆓 免费模式样式 */
.free-mode-section {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(251, 191, 36, 0.1));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.free-mode-toggle {
    font-size: 16px !important;
    font-weight: 600;
}

.free-mode-toggle span {
    color: #22c55e;
}

.free-mode-hint {
    margin-top: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6;
}

.settings-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 20px 0;
}

#proModeSettings.disabled {
    opacity: 0.4;
    pointer-events: none;
}

#proModeSettings.disabled::before {
    content: '🔒 免费模式已启用，无需配置API Key';
    display: block;
    text-align: center;
    padding: 12px;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--accent-gold);
}

/* 免费模式标识 */
.free-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    padding: 10px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}
.form-group input:focus {
    border-color: var(--accent-gold);
    outline: none;
}

.btn-primary {
    background: var(--accent-gold);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}
.btn-primary:hover { background: #e6c200; }
    
    .btn-secondary {
    background: #333;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}
.btn-secondary:hover { background: #444; }

/* 隐藏滚动条但可滚动 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 自定义滚动条样式 */
.custom-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.custom-scroll::-webkit-scrollbar {
    width: 4px;
}
.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
}

/* 角色描述滚动区 */
.char-summary-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* ================= Detailed Flow (Card Steps) Styles ================= */

.detailed-flow-container {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    height: 500px; /* Fixed height for scrolling */
}

.flow-meta-header {
    padding: 15px 20px;
    background: #222;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.flow-meta-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.meta-controls {
    display: flex;
    gap: 8px;
}

.meta-controls button {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #333;
    color: #ccc;
    cursor: pointer;
    font-size: 12px;
}
.meta-controls button:hover {
    background: #444;
    color: #fff;
}

.horizontal-scroll-area {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 20px;
    background: #151515;
    display: flex;
    align-items: center;
}

.flow-stages {
    display: flex;
    align-items: flex-start; /* Top align cards */
    gap: 20px;
    height: 100%;
}

.flow-stage {
    display: flex;
    flex-direction: column;
    min-width: 280px;
    max-width: 320px;
    height: 100%;
}

.flow-stage.wide-stage {
    min-width: 450px;
    max-width: 500px;
}

.stage-title {
    font-size: 13px;
    color: #888;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vertical-stack {
    display: flex;
        flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
    flex: 1;
}
/* Custom scroll for vertical stack */
.vertical-stack::-webkit-scrollbar { width: 4px; }
.vertical-stack::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.flow-arrow-large {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #444;
    height: 100%;
    padding-top: 40px; /* Offset for title */
}

/* Cards */
.flow-card {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
    flex-shrink: 0;
    resize: both;
    overflow: auto;
}
.flow-card:hover {
    border-color: #555;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.flow-card.empty {
    border: 1px dashed #333;
    background: transparent;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.flow-card.error {
    border-color: var(--error-color);
    background: rgba(244, 67, 54, 0.05);
}

.card-header {
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 12px;
    font-weight: bold;
    color: #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header .icon { margin-right: 6px; }

.card-actions {
    display: flex;
    gap: 4px;
}
.btn-xs {
    padding: 2px 6px;
    font-size: 10px;
    border: 1px solid #444;
    background: rgba(0,0,0,0.3);
    color: #aaa;
    border-radius: 3px;
    cursor: pointer;
}
.btn-xs:hover {
    background: #444;
    color: #fff;
    border-color: var(--accent-gold);
}

.card-content {
    padding: 10px;
    font-size: 12px;
    color: #aaa;
}
.text-content {
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.4;
}

/* Script Card Specific */
.script-card .card-content {
    max-height: 300px; /* Script can be longer */
}

/* Char Card Specific */
.char-card {
    display: flex;
    flex-direction: column;
}
.char-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: zoom-in;
}
.char-name {
    font-weight: bold;
    color: var(--accent-gold);
    margin-bottom: 2px;
}
.char-desc {
    font-size: 11px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Scene Flow Row */
.scene-flow-row {
    display: flex;
    align-items: stretch; /* Stretch to match height */
    gap: 10px;
    background: rgba(255,255,255,0.02);
    padding: 10px;
    border-radius: 6px;
    position: relative;
}
.scene-label {
    position: absolute;
    top: -8px;
    left: 10px;
    background: #333;
    padding: 0 6px;
    font-size: 10px;
    color: var(--accent-gold);
    border-radius: 2px;
}
.prompt-card {
    flex: 1;
    min-width: 0; /* Allow shrinking */
}
.video-card {
    width: 200px;
    flex-shrink: 0;
}
.flow-arrow {
    display: flex;
    align-items: center;
    color: #444;
    font-size: 16px;
}

.video-content video {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 4px;
}

/* Final Card */
.final-card {
        width: 100%;
    height: 100%;
    display: flex;
        flex-direction: column;
    }
.final-player {
        width: 100%;
    flex: 1;
    background: #000;
    object-fit: contain;
}
.final-actions {
    margin-top: 10px;
    text-align: center;
}
.btn-primary-sm {
    padding: 6px 12px;
    background: var(--accent-gold);
    color: #000;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
}
.btn-primary-sm:hover {
    background: #e6c200;
}

/* ================= Sketch Board (Banana Node) Styles ================= */
.banana-node {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
    min-height: 350px;
    max-width: 800px;
    max-height: none;
    z-index: 10;
}

.banana-node .node-content {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 200px);
    flex: 1;
}

/* Banana节点可调整尺寸的手柄 */
.banana-node .resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--accent-gold) 50%);
    border-radius: 0 0 8px 0;
    z-index: 20;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.banana-node .resize-handle:hover {
    opacity: 1;
}

.banana-node-header {
    padding: 8px 12px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
}
.banana-node-header:active {
    cursor: grabbing;
}

.node-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 6px;
}

.node-controls button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
}
.node-controls button:hover { color: #fff; }

.node-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: #111;
    gap: 10px;
    overflow: auto;
    min-height: 0; /* 允许flex子元素收缩 */
}

/* 优化下拉菜单显示，防止截断 */
.node-content select {
    width: 100%;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}
.node-content select option {
    background: #222;
    color: #fff;
}

.auto-prompt-box {
    padding: 8px 10px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 6px;
    margin: 0 10px 5px 10px;
    /* 🔧 优化：限制高度，内容可滚动 */
    max-height: 120px; 
    display: flex;
    flex-direction: column;
    display: none; /* 默认隐藏，有内容时由 JS 控制显示 */
}
.auto-prompt-title {
    font-size: 11px;
    color: var(--accent-gold);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    flex-shrink: 0; /* 防止标题被挤压 */
    font-weight: bold;
}
.auto-prompt-content {
    font-size: 11px;
    color: #e5e5e5;
    line-height: 1.4;
    overflow-y: auto;
    white-space: pre-wrap;
    /* 优化滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}
/* 🔧 V7.21.0: 优化引用提示词显示 */
.auto-prompt-text {
    font-size: 10px;
    color: #ccc;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-break: break-all;
    padding: 4px 0;
    /* 滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: rgba(251, 191, 36, 0.5) transparent;
}
.auto-prompt-text::-webkit-scrollbar {
    width: 4px;
}
.auto-prompt-text::-webkit-scrollbar-track {
    background: transparent;
}
.auto-prompt-text::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.5);
    border-radius: 2px;
}
.auto-prompt-text::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 191, 36, 0.8);
}

.node-result-area {
    padding: 0 10px 12px 10px;
    max-height: none;
    overflow: visible;
}

.node-result-image {
    position: relative;
    margin-top: 10px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #05050a;
    overflow: hidden;
    /* 🔧 确保容器高度自适应 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-result-image img {
    /* 🔧 优化：由 width: 100% 改为 auto + max-width */
    /* 这样竖图不会强制占满宽度，而是按比例缩放 */
    width: auto; 
    height: auto;
    max-width: 100%;
    max-height: 400px; /* 高度限制 */
    
    object-fit: contain;
    display: block;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); /* 加一点阴影更有质感 */
}

.result-image-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
}

.result-image-actions button {
    background: rgba(0,0,0,0.7);
    border: none;
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
}

.result-image-actions button:hover {
    background: rgba(0,0,0,0.9);
}

/* Banana节点画布容器 - 可调整尺寸 */
.banana-canvas-wrapper {
    flex: 1;
    min-height: 150px;
    max-height: 500px;
    background: #fff;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    resize: vertical;
}
.banana-canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* Sticker 节点样式 */
.sticker-node .sticker-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sticker-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.sticker-section label {
    color: #bbb;
    font-size: 12px;
}

.sticker-section select,
.sticker-section textarea,
.sticker-section input[type="file"] {
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    padding: 8px;
    font-size: 12px;
}

.sticker-section textarea {
    min-height: 60px;
    resize: vertical;
}

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

.sticker-actions button {
    flex: 1;
    border: none;
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #111;
    font-weight: 600;
}

.sticker-actions button[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.sticker-sheet-box {
    border: 1px dashed #333;
    border-radius: 8px;
    padding: 8px;
    background: #0a0a0f;
}

.sticker-sheet-preview {
    position: relative;
}

.sticker-sheet-preview img {
    width: 100%;
    border-radius: 6px;
}

.sticker-sheet-actions {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    gap: 6px;
}

.sticker-sheet-actions button,
.sticker-tile-actions button {
    border: none;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.sticker-status {
    font-size: 12px;
    color: #fbbf24;
    padding: 6px 8px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
}

.sticker-status.error {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.4);
    background: rgba(255, 107, 107, 0.1);
}

.sticker-empty {
    font-size: 12px;
    color: #666;
    text-align: center;
    padding: 10px;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.sticker-tile {
    position: relative;
    background: #050505;
    border: 1px solid #222;
    border-radius: 6px;
    overflow: hidden;
}

.sticker-tile img {
    width: 100%;
    display: block;
}

.sticker-tile-actions {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
}

.sticker-ref-preview {
    width: 80px;
    border: 1px solid #333;
    border-radius: 6px;
    overflow: hidden;
}

.sticker-ref-preview img {
    width: 100%;
    display: block;
}

/* Drawing Canvas */
.draw-area {
    flex: 1;
    background: #fff;
    border-radius: 4px;
    position: relative;
    cursor: crosshair;
    min-height: 200px;
}
.draw-area canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Tool Bar */
.tool-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #222;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #333;
}

.tool-color {
    width: 24px;
    height: 24px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}

.tool-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #444;
    background: #333;
    color: #ccc;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tool-btn:hover, .tool-btn.active {
    background: #444;
    border-color: var(--accent-gold);
    color: #fff;
}

.tool-clear {
    margin-left: auto;
    color: #f44336;
    border-color: rgba(244, 67, 54, 0.3);
}
.tool-clear:hover {
    background: rgba(244, 67, 54, 0.1);
}

/* Upload Zone */
.image-upload-zone {
    height: 60px;
    border: 1px dashed #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    background: #1a1a1a;
}
.image-upload-zone:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.05);
}

.node-prompt-input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    resize: vertical;
    font-size: 12px;
    min-height: 40px;
}
.node-prompt-input:focus {
    border-color: var(--accent-gold);
    outline: none;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 10000;
    min-width: 120px;
}
.context-menu-item {
    padding: 8px 16px;
    font-size: 13px;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.context-menu-item:hover {
    background: var(--accent-gold);
    color: #000;
}

/* ================= Publish Modal Styles ================= */
.publish-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.platform-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.platform-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1a1a;
    padding: 8px;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.platform-item:hover {
    border-color: #555;
}
.platform-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-gold);
}
.platform-icon {
    font-size: 16px;
}

.form-input {
    width: 100%;
    background: #151515;
    border: 1px solid #333;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
}
.form-input:focus {
    border-color: var(--accent-gold);
    outline: none;
}

.publish-log {
    margin-top: 15px;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    max-height: 150px;
    overflow-y: auto;
}
.log-title {
    font-size: 11px;
    color: #888;
    margin-bottom: 5px;
}
.log-content {
    font-family: monospace;
    font-size: 11px;
    color: #4caf50;
    white-space: pre-wrap;
}

/* 帮助模态框样式 */
.help-content h4 {
    color: var(--accent-gold);
    margin: 15px 0 10px 0;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
}
.help-content p, .help-content li {
    font-size: 13px;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 8px;
}
.help-content code {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
    font-family: monospace;
}
.help-btn-row {
    text-align: center;
    margin-top: 20px;
}

/* ================= Library Overlay Styles ================= */
.library-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Hidden state */
}
.library-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.library-header {
    height: 60px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    background: rgba(30, 30, 30, 0.9);
}

.lib-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close-lib {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}
.btn-close-lib:hover { color: #fff; }

.library-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow: hidden;
}

.lib-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.lib-tab {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    padding: 8px 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}
.lib-tab:hover { color: #ccc; }
.lib-tab.active {
    color: var(--accent-gold);
    font-weight: bold;
}
.lib-tab.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-gold);
}

.lib-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
}
.lib-panel.active {
    display: block;
}

/* === Role Library Cards === */
.lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); /* 增加宽度以适应横向布局 */
    gap: 20px;
    padding-bottom: 20px;
}

.lib-char-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
}

.lib-char-card:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateY(-2px);
}

/* 移除旧的绝对定位样式，改用JS内联控制的Flex布局 */
.char-video-section, .char-image-section, .char-info-overlay, .char-actions {
    position: static; /* 重置定位 */
    width: auto;
    height: auto;
    background: none;
}

.char-video-section video {
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    background: #000;
    /* opacity控制移除，由JS/DOM控制显示 */
}

/* 角色库卡片视频自适应 */
.lib-char-card video {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    background: #000;
    display: block;
}

/* Library Item Card (Legacy/Other items if any) */
.lib-item {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
    group: hover;
}
.lib-item:hover {
    border-color: #555;
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.lib-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #111;
}
.lib-video-preview {
    width: 100%;
    height: 160px;
    object-fit: cover;
        display: none;
    }
.lib-item:hover .lib-thumb { display: none; }
.lib-item:hover .lib-video-preview { display: block; }

.lib-info {
    padding: 12px;
}
.lib-name {
    font-size: 14px;
    color: #fff;
    font-weight: bold;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lib-meta {
    font-size: 12px;
    color: #666;
}

.lib-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}
.lib-item:hover .lib-actions { opacity: 1; }

.lib-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: rgba(0,0,0,0.7);
    border: 1px solid #444;
    color: #fff;
    display: flex;
    align-items: center;
        justify-content: center;
    cursor: pointer;
    font-size: 12px;
}
/* === 补全缺失的横向流式布局 (Mindmap Style) === */
.result-card.horizontal-flow {
    position: absolute; /* 🔧 修复：使用绝对定位支持画布拖拽 */
    width: 2000px; /* 🔧 修复：足够宽以显示6列内容 */
    min-width: 1800px; /* 最小宽度 - 6列 x 300px */
    max-width: none; /* 不限制最大宽度 */
    height: auto; /* 自适应高度 */
    min-height: 500px; /* 最小高度 */
    max-height: 90vh; /* 最大高度为视口的90% */
    padding: 0;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    resize: both; /* 允许用户调整大小 */
    overflow: visible; /* 🔧 修复：不裁剪内容 */
    cursor: default; /* 卡片内部默认光标 */
}

.flow-container {
    flex: 1;
    display: flex;
    overflow-x: visible; /* 🔧 修复：不裁剪水平内容 */
    overflow-y: auto; /* 允许垂直滚动 */
    padding: 10px;
    gap: 15px; /* 增加列间距 */
    min-height: 400px; /* 最小高度 */
    width: 100%; /* 占满父容器 */
}

.flow-column {
    min-width: 280px;
    width: 300px;
    background: #222;
    border-radius: 6px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: auto; /* 🔧 修复：自适应高度 */
    min-height: 400px; /* 最小高度 */
    max-height: 80vh; /* 最大高度 */
}

.flow-column .column-header {
    padding: 10px 15px;
    background: #2a2a2a;
    border-bottom: 1px solid #444;
    font-size: 14px;
    font-weight: bold;
    color: var(--accent-gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* 防止标题被压缩 */
}

.flow-column .column-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0; /* fix flex scrolling */
}

.flow-column .column-content.text-content {
    font-size: 13px;
    line-height: 1.6;
    color: #ddd;
    white-space: pre-wrap;
    word-break: break-word; /* prevent overflow */
    padding-bottom: 20px;
}

.flow-column .column-content.center-content {
    align-items: center;
    justify-content: center;
}

/* Scene Card in Flow */
.flow-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
}
.flow-card .card-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}
.scene-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.scene-prompt {
    font-size: 12px;
    color: #ccc;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    line-height: 1.5;
}
.scene-video-preview {
    height: 140px;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.clip-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.scene-actions {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
}

/* Final Video Player Wrapper */
.final-player-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.final-video {
    width: 100%;
    max-height: 300px;
    background: #000;
    border-radius: 6px;
}
.final-controls {
    display: flex;
    gap: 10px;
}
.btn-play-all, .btn-download-all, .btn-publish-all {
    flex: 1;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    border: none;
    color: #fff;
}
.btn-play-all { background: #333; border: 1px solid #444; }
.btn-download-all { background: #333; border: 1px solid #444; }
.btn-publish-all { background: var(--accent-gold); color: #000; font-weight: bold; margin-top: 5px; }

/* Mind Item (Character) */
.mind-item-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.3s;
    display: flex; /* 确保内部元素可以横向排列 */
}
.mind-item-card:hover {
    border-color: var(--accent-gold);
}

/* 🆕 角色卡片专用样式 */
.mind-item-media {
    background: #000;
    position: relative;
}
.mind-item-video {
    display: block;
}
.mind-item-img-container {
    background: #000;
}
.mind-item-info {
    overflow: hidden;
}

/* === End of Flow Layout === */

/* === 补全丢失的会员支付样式 (Payment Plans) === */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.plan-card {
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}
.plan-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.plan-card.selected {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}
.plan-name {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
}
.plan-price {
    font-size: 18px;
    color: var(--accent-gold);
    font-weight: bold;
    margin-bottom: 10px;
}
.plan-desc {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}
.manual-pay-link {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
}
.manual-pay-link a {
    color: #666;
    text-decoration: none;
    border-bottom: 1px dashed #666;
}
.manual-pay-link a:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

/* === Connection Handles === */
.input-handle {
    position: absolute;
    left: -6px;
    top: 50%;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    cursor: crosshair;
    z-index: 20;
    transform: translateY(-50%);
}
.input-handle:hover {
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 0 8px var(--accent-gold);
}

/* 补全丢失的任务卡片头部按钮样式 */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto; /* 推到右边 */
}

.btn-header-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    color: #888;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-header-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(1.1);
}

/* ================= 欢迎页样式（完整复制自welcome.html） ================= */
.welcome-screen {
    position: relative;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 9999;
    background-image: url('../images/welcome-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 欢迎页用户入口 */
.welcome-user-bar {
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 100;
}

.welcome-login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.welcome-login-btn:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.2);
}

.welcome-user-logged {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background: rgba(251, 191, 36, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 25px;
    color: var(--accent-gold);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.welcome-user-logged:hover {
    background: rgba(251, 191, 36, 0.25);
    transform: translateY(-2px);
}

.welcome-user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 14px;
    font-weight: 600;
}

.welcome-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.welcome-user-name {
    font-weight: 600;
    color: #fff;
}

.welcome-user-quota {
    font-size: 11px;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 4px;
}

.welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        oklch(0.15 0.05 250 / 0.9) 0%,
        oklch(0.20 0.08 260 / 0.8) 50%,
        oklch(0.25 0.12 270 / 0.9) 100%
    );
    filter: brightness(0.7) blur(1px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.welcome-screen.fade-out {
    animation: fadeOut 0.5s ease-in-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 绝对视觉焦点 - "演都不演了"图片 */
.welcome-bg-text {
    position: fixed;
    top: 50%;
    right: 5%;
    transform: translateY(-50%) rotate(-8deg);
    z-index: 1; /* 降低层级，让文字在上面 */
    opacity: 1;
    width: fit-content;
    pointer-events: none;
}

.welcome-bg-text img {
    max-width: 380px;
    height: auto;
    transform: rotate(3deg) scale(1.4);
    filter: 
        drop-shadow(8px 10px 20px rgba(0, 0, 0, 0.8))
        contrast(7.5)
        saturate(0)
        brightness(0.35)
        hue-rotate(-120deg)
        invert(0.35);
    opacity: 0.7; /* 降低透明度 */
    mix-blend-mode: screen;
    border: none;
    background: none;
}

.welcome-bg-text img:hover {
    transform: rotate(3deg) scale(1.5);
}

.welcome-content {
    position: relative;
    z-index: 10; /* 提高层级，确保文字在图片上面 */
    text-align: center;
    max-width: 700px;
    padding: 40px;
    margin-left: 5%; /* 稍微左移，避免与右侧图片重叠 */
    animation: slideUp 1s ease-out;
    /* 添加文字阴影增强可读性 */
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* 📱 移动端欢迎页适配 */
@media (max-width: 768px) {
    .welcome-screen {
        overflow-y: auto !important;
        overflow-x: hidden;
        align-items: flex-start;
        padding-top: 60px;
        padding-bottom: 40px;
    }
    
    .welcome-content {
        max-width: 95vw;
        padding: 20px;
        margin-left: 0;
        margin-bottom: 40px;
    }
    
    .welcome-title {
        font-size: 24px !important;
    }
    
    .welcome-subtitle {
        font-size: 14px !important;
    }
    
    .welcome-desc {
        font-size: 13px !important;
    }
    
    .welcome-quote-box {
        padding: 15px !important;
        margin: 20px 0 !important;
    }
    
    .btn-start-journey {
        padding: 16px 36px !important;
        font-size: 16px !important;
        margin-top: 20px;
    }
    
    .welcome-bg-text {
        display: none; /* 移动端隐藏背景大图 */
    }
    
    .welcome-user-bar {
        top: 10px;
        right: 10px;
    }
}

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

.welcome-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-gold), #ffed4e);
    color: #000;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.welcome-title {
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff, var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-family: 'Ma Shan Zheng', cursive;
    letter-spacing: 8px;
}

.welcome-subtitle {
    font-size: 24px;
    color: #888;
    margin-bottom: 30px;
    font-weight: 300;
}

.welcome-desc {
    font-size: 16px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 40px;
}

.welcome-quote-box {
    font-family: 'Ma Shan Zheng', 'STKaiti', 'KaiTi', 'SimSun', serif;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 900;
    background: linear-gradient(180deg, 
        #FFE55C 0%,
        #FFD700 20%,
        #DAA520 40%,
        #FFD700 60%,
        #FFC125 80%,
        #FFE55C 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 40px auto;
    max-width: 700px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6)) drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.8));
    letter-spacing: 4px;
    transform: rotate(-1deg);
    line-height: 1.6;
    padding: 15px;
    z-index: 100;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.quote-text {
    margin-bottom: 10px;
}

.quote-author {
    font-family: 'Brush Script MT', 'Lucida Handwriting', cursive;
    font-size: 1.1em;
    background: linear-gradient(135deg, 
        #DAA520 0%,
        #B8860B 50%,
        #FFD700 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    margin-top: 10px;
    transform: rotate(0.5deg);
}

.btn-start-journey {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 20px 50px;
    font-family: 'KaiTi', '楷体', cursive;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg,
        oklch(0.68 0.15 45) 0%,
        oklch(0.55 0.18 250) 100%
    );
    border: 1px solid transparent;
    border-radius: 50px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    z-index: 100; /* 🔧 确保按钮在最上层可点击 */
    pointer-events: auto !important;
}

.btn-start-journey::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        oklch(0.75 0.12 45) 0%,
        oklch(0.65 0.15 250) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-start-journey:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.btn-start-journey:hover::before {
    opacity: 1;
}

.btn-start-journey:active {
    transform: translateY(-1px) scale(1.01);
}

/* ================= Cinematic Overlay (Optimized) ================= */
.cinematic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 🔧 修改：透明背景，确保不遮挡底层内容 */
    background: transparent;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    /* 🔧 移除全屏磨砂，防止视觉干扰 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* 🔧 关键：允许点击穿透到下方内容 */
    pointer-events: none;
    animation: fadeIn 0.5s ease-out;
}

.cinematic-content {
    /* 🔧 新增：内容容器，承载磨砂背景和点击事件 */
    background: rgba(0, 0, 0, 0.6); /* 调整为更透明，显出磨砂感 */
    backdrop-filter: blur(20px); /* 加强磨砂 */
    -webkit-backdrop-filter: blur(20px); /* 兼容 Safari */
    border-radius: 20px;
    padding: 30px; /* 减小内边距 */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    pointer-events: auto; /* 恢复内容区域的交互 */
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 500px; /* 减小最大宽度 */
    width: 90%;
    max-height: 90vh; /* 限制最大高度，防止溢出 */
    overflow-y: auto; /* 超出内容允许滚动 */
}

.pixel-art-container {
    width: 300px; /* 🔧 加大尺寸 */
    height: 180px;
    position: relative;
    margin-bottom: 30px;
    /* 像素化渲染 */
    image-rendering: pixelated; 
    /* 📺 CRT 效果背景 */
    background: #111;
    border: 4px solid #333;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 20px rgba(0,0,0,0.8);
    overflow: hidden;
    
    /* 🎞️ 整体黑白到彩色过渡 (包含扫描线) */
    filter: grayscale(100%);
    transition: filter 1s ease;
}

/* 像素小人动画 (SVG) */
.pixel-anim-scene {
    width: 100%;
    height: 100%;
    display: block;
    /* filter: grayscale(100%); 移至容器层级 */
}

/* 📺 扫描线效果 */
.pixel-art-container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* 计时器显示 */
.execution-timer {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
}


/* 🆕 新增：局部遮罩模式（非全屏） */
.cinematic-overlay.mini-mode {
    position: absolute; /* 相对于父容器定位 */
    width: 100%;
    height: 100%;
    border-radius: inherit; /* 继承父容器圆角 */
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 100;
}

.quote-container {
    max-width: 800px;
    padding: 40px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.cine-quote {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 32px;
    color: #fff;
    margin-bottom: 15px;
    line-height: 1.4;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    opacity: 0;
    animation: textFadeIn 1s ease-out forwards 0.5s;
}

.cine-author {
    font-size: 16px;
    color: var(--accent-gold);
    text-align: right;
    font-style: italic;
    opacity: 0;
    animation: textFadeIn 1s ease-out forwards 0.8s;
}

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

.cine-loading {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* 精美 SVG 动画容器 */
.film-evolution-anim {
    width: 80px;
    height: 80px;
    position: relative;
}

.film-evolution-anim svg {
    width: 100%;
    height: 100%;
    filter: grayscale(100%) brightness(0.7);
    animation: evolveToColor 4s linear infinite alternate;
}

@keyframes evolveToColor {
    0% {
        filter: grayscale(100%) brightness(0.7);
        transform: scale(0.95);
    }
    50% {
        filter: grayscale(50%) brightness(0.9);
    }
    100% {
        filter: grayscale(0%) brightness(1.1) drop-shadow(0 0 15px var(--accent-gold));
        transform: scale(1.05);
    }
}

.cine-status {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulseText 2s infinite;
}

@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 🆕 像素动画关键帧 */
@keyframes actorAct {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.95); }
}

@keyframes clapBoard {
    0%, 100% { transform: rotate(-20deg); }
    10% { transform: rotate(0deg); }
    20% { transform: rotate(-20deg); }
}



/* ================= End Cinematic Overlay ================= */

/* ================= 分享模态框样式 ================= */
.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.share-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

.share-header {
    margin-bottom: 20px;
}

.share-header h3 {
    margin: 0;
    font-size: 24px;
    color: var(--accent-gold);
    font-family: 'Ma Shan Zheng', cursive;
}

.share-desc {
    color: #888;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.6;
}

.share-input-group {
    background: #000;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.share-input-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    display: block;
}

.share-input-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.share-input-box input {
    flex: 1;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.share-input-box:last-child {
    margin-bottom: 0;
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-copy-share {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-copy-share:hover {
    background: #444;
    border-color: #666;
}

.btn-verify-share {
    background: linear-gradient(135deg, #4b5563, #374151);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-top: 10px;
}

.btn-verify-share:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-gold), #ffed4e);
    color: #000;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-verify-share:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-verify-share:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-claim-share {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    display: none; /* Initially hidden */
    animation: pulse 2s infinite;
}

/* --- New 6-Column Layout Widths --- */
.flow-column.col-script {
    min-width: 250px;
    flex: 1; /* 允许剧本列伸缩 */
}

.flow-column .column-content {
    flex: 1;
    overflow-y: auto; /* 确保内容可垂直滚动 */
    height: 100%; /* 占满高度 */
    padding-bottom: 20px; /* 底部留白 */
}

/* 优化文本内容滚动 */
.flow-column .column-content.text-content {
    max-height: none; /* 移除最大高度限制 */
    overflow-y: auto;
}

.flow-column.col-storyboard-text {
    min-width: 250px;
}

.flow-column.col-prompts {
    min-width: 250px;
}

.flow-column.col-video-clips {
    min-width: 280px;
}

/* ================= Knolling Node Styles (Appended) ================= */
.knolling-node {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow: visible; /* Ensure handles visible */
}

.knolling-node-header {
    padding: 10px 15px;
    background: linear-gradient(to right, #333, #222);
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    color: #e5e7eb;
    font-weight: bold;
    font-size: 13px;
    border-radius: 8px 8px 0 0;
}

.knolling-content {
    flex: 1;
    background: #111;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    display: flex;
        flex-direction: column;
    }
    
.knolling-form {
    padding: 15px;
    display: flex;
        flex-direction: column;
    gap: 12px;
    height: 100%;
}

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

.k-group label {
    font-size: 12px;
    color: #9ca3af;
}

.k-input {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.k-input:focus {
    border-color: var(--accent-gold);
}

.btn-k-gen {
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    color: #000;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 5px;
    transition: filter 0.2s;
}

.btn-k-gen:hover {
    filter: brightness(1.1);
}

.btn-k-gen:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.k-output {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #d1d5db;
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.4;
    resize: none;
    min-height: 100px;
}

.k-status {
    font-size: 11px;
    color: #fbbf24;
    height: 16px;
    display: flex;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════════
   🎬 产品类型切换Tab（视频/漫画）
   ═══════════════════════════════════════════════════════════════ */
.product-type-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.product-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    color: #888;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.product-tab.active {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));
    border-color: var(--accent-gold, #fbbf24);
    color: var(--accent-gold, #fbbf24);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.product-tab.active svg {
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}

.product-tab svg {
    flex-shrink: 0;
}

/* 漫画模式下隐藏视频相关选项 */
.comic-mode .video-only {
    display: none !important;
}

/* 视频模式下隐藏漫画相关选项 */
.video-mode .comic-only {
    display: none !important;
}

/* 漫画风格选择器 */
.comic-style-selector {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.comic-style-selector .section-title {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.comic-style-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.comic-style-btn {
    flex: 1;
    min-width: 70px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #aaa;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

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

.comic-style-btn.active {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(78, 205, 196, 0.1));
    border-color: #4ECDC4;
    color: #4ECDC4;
}

/* 漫画页数设置 */
.comic-pages-setting {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comic-pages-setting label {
    font-size: 12px;
    color: #888;
}

.comic-pages-setting select {
    flex: 1;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
}

/* 🔧 修复漫画设置下拉框选项颜色 */
.comic-pages-setting select option {
    background: #1a1a1a;
    color: #fff;
    padding: 8px;
}

/* 漫画预览阅读器 */
.comic-reader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.comic-reader-overlay.show {
    display: flex;
}

.comic-reader-container {
    width: 90vw;
    max-width: 800px;
    height: 90vh;
    background: #1a1a2e;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.comic-reader-header {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.comic-reader-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.comic-reader-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comic-reader-close:hover {
    background: rgba(255, 100, 100, 0.3);
}

.comic-reader-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.comic-page {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.comic-reader-footer {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.comic-reader-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--accent-gold), #f59e0b);
    border: none;
    border-radius: 20px;
    color: #000;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comic-reader-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.comic-reader-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.comic-reader-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

/* ==================== ✏️ 手绘画板节点样式 ==================== */

.sketchpad-node {
    background: linear-gradient(145deg, #1e1e2e, #252535);
    border: 1px solid #4a4a5a;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sketchpad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(90deg, #3b3b4f, #2d2d3d);
    border-bottom: 1px solid #4a4a5a;
    cursor: move;
}

.sketchpad-header span {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
}

.sketchpad-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: #222;
    border-bottom: 1px solid #333;
    flex-wrap: wrap;
}

.sketchpad-tool {
    width: 28px;
    height: 28px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #333;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sketchpad-tool:hover {
    background: #444;
    border-color: #666;
}

.sketchpad-tool.active {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
}

.sketchpad-color {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.sketchpad-size {
    width: 60px;
    height: 4px;
    cursor: pointer;
}

.sketchpad-canvas-wrapper {
    flex: 1;
    background: #fff;
    margin: 8px;
    border-radius: 6px;
    overflow: hidden;
    min-height: 200px;
}

.sketchpad-canvas-wrapper canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.sketchpad-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #1a1a2a;
    border-top: 1px solid #333;
    justify-content: center;
}

.sketchpad-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.sketchpad-actions button:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

