: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;
}

* {
    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);
    overflow: hidden; /* 单页面应用 */
    height: 100vh;
}

.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);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
    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;
}

/* 并发控制 */
.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: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 6px;
    border-radius: 4px;
    font-size: 12px;
}

.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;
}
.idea-item:hover {
    border-color: #555;
}
.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;
}

.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;
}

.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;
}

.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;
}

/* ================= 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: 300px;
    min-height: 400px;
    resize: both;
    z-index: 10;
}

.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: hidden;
}

/* 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;
}

/* Output Handle */
.output-handle {
    position: absolute;
    right: -10px;
    top: 50%;
    width: 16px;
    height: 16px;
    background: var(--accent-gold);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: crosshair;
    transform: translateY(-50%);
    z-index: 20;
    transition: transform 0.2s;
}
.output-handle:hover {
    transform: translateY(-50%) scale(1.2);
}

/* 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;
}

.lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding-bottom: 50px;
}

/* Library Item Card */
.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 {
    width: auto;
    min-width: 800px;
    max-width: 1200px; /* 限制最大宽度，防止过宽 */
    height: 550px; /* 增加高度适应内容 */
    padding: 0;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    resize: both; /* 允许用户调整大小 */
    overflow: hidden;
}

.flow-container {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    gap: 15px; /* 增加列间距 */
}

.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: 100%;
}

.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;
}

.flow-column .column-content.text-content {
    font-size: 13px;
    line-height: 1.6;
    color: #ddd;
    white-space: pre-wrap;
}

.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: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.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;
}
.mind-item-card:hover {
    border-color: var(--accent-gold);
}

/* === 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);
}
