/* 全局变量：极致紧凑的极简暗色主题 (Notepad++ / Code 编辑器风格) */
:root {
	--bg-primary: #1e1e1e;
	--bg-secondary: #252526;
	--bg-tertiary: #2d2d30;
	--bg-header: #333333;
	--bg-interactive: #3e3e42;
	--bg-interactive-hover: #505050;

	--border-primary: #454545;
	--border-secondary: #555555;
	--border-focus: #007acc;

	--text-primary: #d4d4d4;
	--text-secondary: #e8e8e8;
	--text-muted: #858585;

	--accent-primary: #007acc;
	--accent-glow: rgba(0, 122, 204, 0.4);
	--accent-success: #4caf50;
	--accent-danger: #f44336;
	--accent-warning: #ff9800;
	--accent-highlight: #ffc107;
	
	/* === Choice 轮换颜色调色板（10个优雅柔和色，暗主题完美适配）=== */
    --choice-color-0: #5A9EDB;   /* 专业蓝 */
    --choice-color-1: #3EC9B8;   /* 青绿 */
    --choice-color-2: #6BCB82;   /* 自然绿 */
    --choice-color-3: #E9B350;   /* 温暖金橙 */
    --choice-color-4: #E36F7E;   /* 柔和珊瑚 */
    --choice-color-5: #A38BFF;   /* 优雅淡紫 */
    --choice-color-6: #4FC9FF;   /* 明亮天蓝 */
    --choice-color-7: #7ED9BD;   /* 薄荷清新 */
    --choice-color-8: #F0A35F;   /* 蜜橙 */
    --choice-color-9: #C78EFF;   /* 浪漫浅紫 */
}

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

body { 
    background-color: var(--bg-primary); 
    height: 100vh; 
    overflow: hidden; 
    color: var(--text-primary); 
    /* 引入商用级系统字体栈，统一双端字体渲染 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    /* 彻底禁止移动端浏览器自作主张的字体缩放 */
    -webkit-text-size-adjust: 100%;
}

.container { display: flex; flex-direction: column; height: 100vh; }

/* 头部栏缩紧 */
header { display: flex; justify-content: space-between; align-items: center; padding: 2px 5px; background-color: var(--bg-header); border-bottom: 1px solid var(--border-primary); z-index: 10; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo h3 { font-size: 1.1rem; color: var(--text-secondary); font-weight: normal; }
.logo .icon { font-size: 1.2rem; color: var(--accent-highlight); }

.controls { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

.btn { background-color: transparent; color: var(--text-primary); border: 1px solid transparent; padding: 4px 10px; border-radius: 3px; cursor: pointer; display: flex; align-items: center; gap: 4px; transition: all 0.1s; font-size: 0.85rem; }
.btn:hover { background-color: var(--bg-interactive); border-color: var(--border-secondary); }
.btn:active { background-color: var(--bg-interactive-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-play { color: var(--accent-success); border-color: var(--border-secondary); background: var(--bg-interactive);}

.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; background-color: var(--bg-header); border: 1px solid var(--border-primary); min-width: 140px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 1001; padding: 4px; top: 100%; right: 0; border-radius: 3px; }
.dropdown-content button { color: var(--text-primary); padding: 6px 8px; display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: none; cursor: pointer; font-size: 0.85rem; border-radius: 2px; }
.dropdown-content button:hover { background-color: var(--bg-interactive); }
@media (hover: hover) {
    .dropdown:hover .dropdown-content { display: block; }
}
/* 画布 - 取消原生滚动，隐藏溢出 */
.workspace { flex: 1; background-color: var(--bg-primary); position: relative; overflow: hidden; cursor: grab; background-size: cover; background-position: center; }
.workspace.has-bg { background-color: rgba(30, 30, 30, 0.8); background-blend-mode: darken; }
.workspace.dragging { cursor: grabbing; }

/* 容器 - 用于应用整体 Transform 偏移和缩放 */
.node-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform-origin: 0 0; }
#connectionSvg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }

/* 节点卡片 - 极简透明风 */
.node { background-color: rgba(37, 37, 38, 0.8); border: 1px solid var(--border-secondary); border-radius: 4px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); position: absolute; width: 260px; z-index: 5; backdrop-filter: blur(1px); }
.node[data-drag-handle="true"] { cursor: move; }
.node.is-story-start { background-color: rgba(45, 45, 48, 0.9); border-color: var(--accent-success); width: auto; }
.node.is-story-start .node-header { background: transparent; border: none; padding: 6px 10px; }
.node.is-story-start .node-title { color: #7ce74f; }
.node.is-story-start .node-actions, .node.is-story-start textarea, .node.is-story-start .choices-container, .node.is-story-start .node-preview { display: none; }

.node-header { 
    background: linear-gradient(90deg, rgba(0, 122, 204, 0.25) 0%, rgba(45, 45, 48, 0.8) 100%); /* 优雅的暗色渐变 */
    padding: 6px 10px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-primary); 
    border-top-left-radius: 3px; 
    border-top-right-radius: 3px; 
    cursor: move; 
}
/* 修改后的节点标题样式 */
.node-title { 
    font-size: 0.9rem; 
    color: #ffffff; /* 纯白文字提升对比度 */
    font-weight: 500;
    display: flex; 
    align-items: center; 
    gap: 6px; 
    flex: 1; 
    min-width: 0; /* 必须加这个：强制 Flex 子项允许内部收缩，从而触发省略号 */
    margin-right: 10px; /* 留出一点空间，绝对不与右侧按钮重叠 */
    background-color: transparent; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.6); 
}

/* 专门针对标题文字的截断 */
.node-title span {
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}

/* 保证图标不会被长文本挤压变形 */
.node-title .edit-mode-icon { 
    color: var(--accent-success); 
    flex-shrink: 0; 
}

.node-actions { display: flex; gap: 4px; }
.node-action { background: transparent; border: 1px solid transparent; width: 22px; height: 22px; border-radius: 3px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.1s; }
.node-action:hover { background: var(--bg-interactive); color: var(--text-primary); border-color: var(--border-secondary); }
.node-action.active-mode {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}
.node-content { padding: 6px; }
textarea { width: 100%; background: #1e1e1e; border: 1px solid var(--border-primary); border-radius: 3px; padding: 6px; color: var(--text-primary); font-size: 0.85rem; min-height: 80px; resize: vertical; line-height: 1.4; outline: none; }
textarea:focus { border-color: var(--border-focus); }

.choices-container { margin-top: 6px; border-top: 1px dashed var(--border-primary); padding-top: 6px; }
.choice { display: flex; align-items: center; margin-bottom: 4px; gap: 6px; }
.choice-input { flex: 1; background: #1e1e1e; border: 1px solid var(--border-primary); border-radius: 3px; padding: 4px 6px; color: var(--text-primary); font-size: 0.8rem; outline: none; }
.choice-input:focus { border-color: var(--border-focus); }

.add-choice { background: transparent; border: 1px dashed var(--border-secondary); color: var(--text-muted); width: 100%; padding: 4px; border-radius: 3px; cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 4px; }
.add-choice:hover { border-color: var(--text-secondary); color: var(--text-secondary); }

/* ====================== 连接锚点按钮 - 优化版（白色环始终紧贴底色） ====================== */
/* 商用级优化：白色圆边默认就无缝紧贴彩色底圆，hover 只轻微整体放大 */
.connect-btn { 
    background-color: var(--choice-color, var(--bg-interactive)); 
    border: 1px solid transparent;                    /* 改用多层 box-shadow 实现紧贴白环 */
    color: #ffffff;                    
    border-radius: 50%; 
    width: 18px; 
    height: 18px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.12s ease,
                filter 0.12s ease;
    z-index: 15; 
    flex-shrink: 0; 
    font-size: 0.62rem; 
    box-shadow: 
        0 1px 4px rgba(0, 0, 0, 0.4),           /* 基础阴影 */
        0 0 0 2px rgba(255, 255, 255, 0.68);    /* 常驻白色紧贴环（解决间隙） */
}

.connect-btn:hover { 
    transform: scale(1.16);                     /* 轻微优雅放大（比原来 1.2 小一点，更自然） */
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.45),
        0 0 0 2.5px rgba(255, 255, 255, 0.92),  /* hover 时白环更亮 */
        0 0 0 7px var(--accent-glow);           /* 轻微外发光 */
    filter: brightness(1.08);
}

.connect-btn.connected {
    box-shadow: none;
}

/* 折叠状态 */
.connect-btn.collapsed {
    opacity: 0.78;
}

/* Broken 状态（分裂后）- 优先级最高 */
.connect-btn.broken {
    background-color: var(--accent-danger) !important;
    border-color: var(--accent-danger) !important;
    color: #ffffff !important;
    box-shadow: 
        0 1px 4px rgba(0, 0, 0, 0.5),
        0 0 0 2px rgba(255, 255, 255, 0.45) !important;
}

.connect-btn.broken:hover {
    transform: scale(1.16);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 0 0 2.5px rgba(255, 255, 255, 0.7) !important;
}

.node-preview { padding: 8px; }
.preview-content { font-size: 0.85rem; line-height: 1.4; margin-bottom: 8px; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; user-select: text; max-height: 150px; overflow-y: auto;}
.preview-choices { display: flex; flex-direction: column; gap: 4px; }
.preview-choice { display: flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-primary); border-radius: 3px; padding: 4px 2px; font-size: 0.8rem; }
.preview-choice-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #d6fed8ab;
    cursor: text;
    background-color: rgb(14 70 107 / 25%);
    font-size: 0.85rem;
}
/* ==================== Choice 拖拽排序 - 商用视觉增强 ==================== */
.choice-drop-indicator {
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), #00d4ff);
    box-shadow: 0 0 12px var(--accent-primary);
    margin: 6px 12px;
    border-radius: 3px;
    pointer-events: none;
}

.preview-choices:has(.choice-drop-indicator) .preview-choice {
    transition: margin 0.15s ease;
}

/* 拖拽时容器轻微高亮 */
.preview-choices:has(.dragging-source) {
    background: rgba(0, 122, 204, 0.06);
    border-radius: 4px;
}
/* ==================== Choice 拖拽排序 - 拖拽时隐藏原元素 ==================== */
.preview-choice.dragging-source {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* 拖拽影像的样式（浏览器自动创建的半透明副本） */
.preview-choice.dragging-source * {
    visibility: hidden !important;
}

.inline-edit { width: 100%; margin: 0; }

.connection-line { 
    stroke: var(--choice-color, var(--accent-primary)); 
    stroke-width: 1.85; 
    fill: none; 
    marker-end: url(#arrowhead); 
    pointer-events: stroke; 
    cursor: pointer; 
    transition: stroke 0.15s ease, stroke-width 0.15s ease, opacity 0.15s; 
    opacity: 0.78; 
}

.connection-line:hover { 
    stroke: var(--accent-highlight) !important; 
    stroke-width: 2.8; 
    opacity: 1; 
}

.connection-line.highlighted { 
    stroke: var(--accent-highlight) !important; 
    stroke-width: 2.8; 
    opacity: 1; 
}
/* 拖拽添加选择时的目标节点高亮 */
.node.drag-add-choice-target {
    box-shadow: 0 0 0 3px var(--accent-success), 0 8px 25px rgba(0,0,0,0.3) !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}
/* 拖拽添加选择时的临时连线样式 */
.drag-add-choice-line {
    pointer-events: none;
}
.temp-line { stroke: #1abc9c !important; stroke-width: 2 !important; fill: none; stroke-dasharray: 4; }
.connecting-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: transparent; z-index: 999; pointer-events: all; }

/* 全屏编辑态也变成居中浮层的样式 */
.node.fullscreen-active { 
    position: absolute; 
    z-index: 1002; 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-focus); 
    padding: 10px; 
    display: flex; 
    flex-direction: column; 
    cursor: default; 
    transform: none !important; 
    backdrop-filter: none;
}
.node.fullscreen-active .node-header { flex-shrink: 0; margin-bottom: 10px; cursor: default; }
.node.fullscreen-active .node-content { flex-grow: 1; display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 0; }
.node.fullscreen-active textarea { height: 100%; resize: none; font-size: 0.95rem; font-family: auto; min-height: 0; overflow-y: auto; }
.node.fullscreen-active .choices-container { display: none; }

.status-bar { position: fixed; bottom: 0; left: 0; width: 100%; background-color: var(--accent-primary); color: #fff; padding: 2px 10px; font-size: 0.75rem; z-index: 100; display: flex; align-items: center; gap: 8px;}
.zoom-controls { position: fixed; bottom: 25px; right: 10px; background-color: var(--bg-tertiary); border: 1px solid var(--border-primary); color: var(--text-primary); padding: 2px; border-radius: 4px; font-size: 0.8rem; z-index: 100; display: flex; align-items: center; gap: 2px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.zoom-controls button { background: none; border: none; color: var(--text-primary); font-size: 1rem; cursor: pointer; width: 24px; height: 24px; border-radius: 2px; display: flex; align-items: center; justify-content: center; }
.zoom-controls button:hover { background-color: var(--bg-interactive); }

/* Play 模式与其它弹窗保持轻量 */
.play-mode { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0, 0.8); z-index: 1000; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity 0.2s; backdrop-filter: blur(5px); }
.play-mode.active { opacity: 1; pointer-events: all; display: flex;}
.story-container { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-primary); 
    border-radius: 6px; 
    width: 100%; 
    max-width: 700px; 
    max-height: 85vh; 
    padding: 15px 20px; /* 【优化】减小四周留白，扩大内容区 */
    overflow-y: auto; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
    position: relative; 
    display: flex; 
    flex-direction: column;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; 
}
.story-content { 
    font-size: 1rem; 
    line-height: 1.6; 
    margin-top: 5px; 
    margin-bottom: 15px; /* 【优化】缩减正文与上下元素的间距 */
    color: var(--text-primary); 
    white-space: pre-wrap; 
}
.story-choice { background-color: var(--bg-tertiary); border: 1px solid var(--border-secondary); border-radius: 4px; padding: 10px 15px; color: var(--text-secondary); font-size: 0.9rem; cursor: pointer; transition: all 0.1s; text-align: left; width: 100%; margin-bottom: 8px;}
.story-choice:hover { background-color: var(--bg-interactive); border-color: var(--accent-primary); }
.close-play { position: absolute; top: 5px; right: 5px; background: transparent; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; }
.close-play:hover { color: var(--accent-danger); }

.file-input { display: none; }
.context-menu { position: absolute; background: var(--bg-tertiary); border: 1px solid var(--border-primary); border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 1000; padding: 2px; display: none; }
.context-menu button { background: none; border: none; color: var(--text-primary); padding: 6px 12px; width: 100%; text-align: left; cursor: pointer; font-size: 0.85rem; border-radius: 2px;}
.context-menu button:hover { background-color: var(--accent-primary); color: white; }

/* 解决移动端 Dropdown 点击不弹出的问题 */
.dropdown-content.show { display: block; }

/* 播放模式下：无后续连接的选项的禁用样式 */
.story-choice.disabled-choice {
    opacity: 0.5;
    cursor: not-allowed;
    border-style: dashed;
}
.story-choice.disabled-choice:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-secondary);
}
/* 播放模式：已遍历过的选项背景色 */
.story-choice.visited-choice {
    background-color: rgba(0, 122, 204, 0.25); /* 淡淡的强调色背景 */
    border-color: var(--accent-primary);
}
/* 播放模式：返回上一层按钮 */
.back-play {
    margin-top: 15px; /* 与上方剧情选项拉开间距 */
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-secondary); /* 虚线框区分主线选择 */
    padding: 8px 2px;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 4px;
    transition: all 0.1s;
    width: 100%;
}
.back-play:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background-color: var(--bg-interactive);
}

/* --- 搜索与定位面板 --- */
.search-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    pointer-events: none; /* 允许穿透点击背景画布 */
    z-index: 2000; display: none; 
}
.search-modal-overlay.active { display: block; }

.search-modal-content {
    position: absolute; top: 60px; right: 20px; width: 320px;
    background: var(--bg-secondary); border: 1px solid var(--border-focus);
    border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    padding: 15px; pointer-events: all; /* 恢复面板本身的点击能力 */
    display: flex; flex-direction: column; gap: 12px;
}
.search-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border-primary); padding-bottom: 8px;
}
.search-header h3 { font-size: 1rem; color: var(--text-secondary); margin: 0; }
.search-header .close-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
}
.search-header .close-btn:hover { color: var(--accent-danger); }
.search-controls { display: flex; flex-direction: column; gap: 10px; }
#searchInput {
    width: 100%; background: var(--bg-primary); border: 1px solid var(--border-primary);
    color: var(--text-primary); padding: 8px; border-radius: 4px; outline: none; transition: border-color 0.2s;
}
#searchInput:focus { border-color: var(--border-focus); }
.search-options { display: flex; gap: 15px; font-size: 0.85rem; color: var(--text-secondary); }
.search-options label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.search-actions {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-tertiary); padding: 6px 10px; border-radius: 4px; border: 1px solid var(--border-primary);
}
#searchResultCount { font-size: 0.85rem; color: var(--text-muted); }
.search-actions .btn { padding: 4px 12px; }
.search-quick-actions { border-top: 1px dashed var(--border-primary); padding-top: 12px; }

/* 搜索高亮动效 */
.node.search-highlight {
    box-shadow: 0 0 0 4px var(--accent-highlight), 0 10px 30px rgba(0,0,0,0.5) !important;
    transform: scale(1.02); transition: box-shadow 0.3s, transform 0.3s; z-index: 100;
}

/* 故事管理器样式 */
.current-story-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    margin-left: 12px;
}

.current-story-indicator:hover {
    background: rgba(255, 255, 255, 0.15);
}

.story-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid var(--border-secondary);
    transition: all 0.2s;
    cursor: pointer;
}

.story-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-primary);
}

.story-item.active {
    background: rgba(26, 188, 156, 0.15);
    border-color: var(--accent-success);
}

.story-item-info {
    flex: 1;
    min-width: 0;
}

.story-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制最多显示两行 */
    -webkit-box-orient: vertical;
    white-space: normal; /* 覆盖单行限制 */
    word-break: break-all; /* 防止长串无空格的英文字母/链接撑破布局 */
    line-height: 1.3;
}

.story-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.story-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.story-item-btn {
    background: var(--bg-interactive);
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-item-btn:hover {
    background: var(--border-primary);
}

.delete-story-btn:hover {
    background: var(--accent-danger);
}

.choice-drop-indicator {
    height: 2px;
    background: var(--accent-success);
    margin: 2px 0;
    border-radius: 1px;
}

.preview-choice.dragging-source {
    opacity: 0.4;
}

#qrcode-container { display: flex; justify-content: center; background: white; padding: 10px; border-radius: 4px; width: fit-content; margin: 10px auto; }

/* SaaS版基础结构样式补全 (已优化匹配主界面暗色主题) */
/* =========================================
   落地页 (Landing Page) 样式重构
   ========================================= */
#auth-screen { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    z-index: 9999; background: var(--bg-primary); 
    display: none; 
    align-items: flex-start; /* 【关键修改1】改为 flex-start，解决高度超限时的顶部截断问题 */
    justify-content: center; 
    backdrop-filter: blur(5px); 
    overflow-y: auto; 
    overscroll-behavior-y: none; /* 【关键修改2】彻底禁用移动端的下拉刷新和橡皮筋效果 */
    -webkit-overflow-scrolling: touch; /* 【关键修改3】开启 iOS 顺滑滚动 */
    padding: 5vh 0; /* 增加上下安全内边距 */
}
#auth-screen.active { display: flex; }

.auth-wrapper {
    display: flex;
    width: 900px;
    max-width: 95%;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    border: 1px solid var(--border-primary);
    overflow: hidden;
    margin: auto; /* 【关键修改4】利用 flex 环境下的 margin: auto 实现安全的自适应垂直居中 */
    flex-shrink: 0; /* 【关键修改5】防止高度超限时被外层强行挤压缩水 */
}

.auth-marketing {
    flex: 1.2;
    background: linear-gradient(135deg, rgba(0, 122, 204, 0.15) 0%, rgba(30, 30, 30, 0.8) 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--border-primary);
}

.marketing-content { color: var(--text-primary); }

.brand-title {
    font-size: 2.2rem;
    color: #ff9800;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.brand-title .icon { color: var(--accent-primary); }

.marketing-subtitle {
    font-size: 1.05rem;
    color: var(--accent-primary);
    line-height: 1.6;
    margin-bottom: 30px;
    font-weight: normal;
}

.marketing-features {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.marketing-features li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.marketing-features i {
    color: var(--accent-success);
    font-size: 1.2rem;
    margin-top: 2px;
}

.auth-container { 
    flex: 1;
    padding: 40px; 
    background: var(--bg-secondary); 
    color: var(--text-primary); 
    display: flex;
    flex-direction: column;
    justify-content: center;
}
/* Auth 内部表单组件复用 */
.auth-tabs { display: flex; margin-bottom: 20px; }
.tab-btn { flex: 1; padding: 10px; background: transparent; border: none; border-bottom: 2px solid var(--border-primary); color: var(--text-muted); cursor: pointer; transition: 0.3s; font-size: 0.95rem;}
.tab-btn.active { border-color: var(--accent-primary); color: var(--text-primary); }
.auth-form { display: none; flex-direction: column; gap: 15px; }
.auth-form.active { display: flex; }
.auth-form input { padding: 12px; background: var(--bg-tertiary); border: 1px solid var(--border-primary); color: var(--text-primary); border-radius: 4px; outline: none; transition: border-color 0.2s;}
.auth-form input:focus { border-color: var(--border-focus); }
#workspace-screen { display: none; width: 100%; height: 100vh; flex-direction: column;}
#workspace-screen.active { display: flex; }
.auth-header { text-align: center; margin-bottom: 20px; }
.auth-tabs { display: flex; margin-bottom: 20px; }
.tab-btn { flex: 1; padding: 10px; background: transparent; border: none; border-bottom: 2px solid var(--border-primary); color: var(--text-muted); cursor: pointer; transition: 0.3s; font-size: 0.95rem;}
.tab-btn.active { border-color: var(--accent-primary); color: var(--text-primary); }
.auth-form { display: none; flex-direction: column; gap: 15px; }
.auth-form.active { display: flex; }
.auth-form input { padding: 12px; background: var(--bg-tertiary); border: 1px solid var(--border-primary); color: var(--text-primary); border-radius: 4px; outline: none; transition: border-color 0.2s;}
.auth-form input:focus { border-color: var(--border-focus); }
.btn-primary { padding: 12px; background: var(--accent-primary); border: none; color: white; border-radius: 4px; cursor: pointer; font-weight: normal; font-size: 0.95rem; transition: background 0.2s; }
.btn-primary:hover { filter: brightness(1.1); }
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; }
.toast { padding: 12px 20px; margin-bottom: 10px; border-radius: 4px; color: white; background: var(--accent-success); box-shadow: 0 4px 10px rgba(0,0,0,0.4); font-size: 0.9rem; }
.toast.error { background: var(--accent-danger); }

/* Modal 通用样式 (已优化) */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 5000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px);}
.modal.active { display: flex; }
.modal-content { background: var(--bg-secondary); padding: 30px; width: 800px; max-width: 95%; max-height: 90vh; overflow-y: auto; border-radius: 8px; color: var(--text-primary); border: 1px solid var(--border-primary); box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; font-size: 1.1rem; border-bottom: 1px solid var(--border-primary); padding-bottom: 10px;}
.close-modal { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: color 0.2s;}
.close-modal:hover { color: var(--accent-danger); }
.ptab-content { display: none; }
.ptab-content.active { display: block; animation: fadeIn 0.3s ease; }
.section-box { background: var(--bg-tertiary); padding: 15px; margin-bottom: 15px; border-radius: 6px; border: 1px solid var(--border-primary); }
.input-group { display: flex; gap: 10px; }
.input-group input { flex: 1; padding: 10px; background: var(--bg-primary); border: 1px solid var(--border-primary); color: var(--text-primary); border-radius: 4px; outline: none; }
.input-group input:focus { border-color: var(--border-focus); }

.credit-hero { text-align: center; padding: 30px; background: var(--bg-tertiary); border-radius: 6px; border: 1px solid var(--border-primary); margin-bottom: 20px;}
.credit-hero h2 { font-size: 3em; color: var(--accent-primary); margin: 0; line-height: 1; }
.credit-hero p { color: var(--text-muted); margin-top: 10px; font-size: 0.8rem; }

.referral-compact { display: flex; gap: 15px; margin-bottom: 15px; background: var(--bg-tertiary); padding: 15px; border-radius: 6px; align-items: center; border: 1px solid var(--border-primary);}
.qr-box { background: white; padding: 5px; border-radius: 4px; text-align: center;}
/* =========================================
   个人中心 (Profile Modal) 深度优化
   ========================================= */
.profile-modal-content {
    padding: 24px;
    font-size: 0.9rem; /* 强制基础字体与导图一致 */
}
.profile-modal-content .modal-header {
    margin-bottom: 15px;
    padding-bottom: 12px;
}

/* 导航 Tabs */
.profile-tabs {
    display: flex;
    margin-bottom: 20px;
    gap: 8px;
}
.profile-tabs .tab-btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    border-bottom-width: 2px;
}

/* 通用区块 (Section Box) 优化 */
.section-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-primary);
    padding: 18px;
    margin-bottom: 16px;
    border-radius: 6px;
}
.section-box h4 {
    margin: 0 0 12px 0; /* 修复原有标题与输入框靠得太近的问题 */
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    font-weight: 500;
}
.section-box .sub-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 8px;
    font-weight: normal;
}

/* 个人资料信息网格 */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.info-item label {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 6px;
}
.info-item input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    font-weight: 500;
}
.info-item input.status-active { color: var(--accent-success); }

/* 按钮统一精简 */
.btn-primary, .btn-danger, .btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-danger { background: var(--accent-danger); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-interactive); color: var(--text-primary); border: 1px solid var(--border-primary); }
.btn-secondary:hover { background: var(--bg-interactive-hover); }

/* 积分展示区 (Hero) */
.credit-hero {
    text-align: center;
    background: linear-gradient(180deg, rgba(45, 45, 48, 0.6) 0%, rgba(30, 30, 30, 0.2) 100%);
}
.credit-hero-main { font-size: 2.2rem; font-weight: 600; color: var(--accent-primary); line-height: 1.2; }
.hero-subtext { font-size: 0.85rem; color: var(--text-muted); margin-top: 6px; }
.credit-details { font-size: 0.85rem; color: var(--text-muted); margin-top: 12px; display: flex; justify-content: center; gap: 20px; }
.credit-badge { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,0.2); padding: 4px 10px; border-radius: 12px; }

/* 强调区块 (兑换积分) */
.highlight-box { border-color: #5b468a; background: rgba(128, 90, 213, 0.05); }
.highlight-btn { background: #805ad5; }

/* 规则说明框 */
.rule-box {
    font-size: 0.85rem; color: #a0aec0; background: rgba(0,0,0,0.2);
    padding: 12px; border-radius: 4px; line-height: 1.6; margin-bottom: 16px;
    border-left: 3px solid var(--accent-primary);
}

/* 邀请区域左右排版 */
.referral-compact { display: flex; gap: 20px; align-items: flex-start; }
.qr-box { background: white; padding: 6px; border-radius: 4px; text-align: center; flex-shrink: 0; }
.btn-download-qr {
    background: transparent; border: none; color: #333; font-size: 0.8rem;
    margin-top: 6px; cursor: pointer; width: 100%; display: block;
}
.btn-download-qr:hover { color: var(--accent-primary); }
.referral-links { flex: 1; min-width: 0; }
.referral-links label { font-size: 0.8rem; color: var(--text-muted); display: block; margin-bottom: 4px; }
.copy-group { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.code-display { flex: 1; background: rgba(0,0,0,0.3); padding: 8px 12px; border-radius: 4px; font-size: 1.1rem; font-weight: 600; color: var(--accent-primary); letter-spacing: 1px; }

/* 统一列表样式 (替代JS内联) */
.list-container { max-height: 220px; overflow-y: auto; padding-right: 4px; }
.list-container::-webkit-scrollbar { width: 6px; }
.list-container::-webkit-scrollbar-thumb { background: var(--border-secondary); border-radius: 3px; }
.styled-list { list-style: none; padding: 0; margin: 0; }
.styled-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 8px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.styled-list li:last-child { border-bottom: none; }
.list-empty { text-align: center; color: var(--text-muted); padding: 15px !important; font-size: 0.85rem; justify-content: center !important; }

.modal-footer-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* =========================================
   统一顶部核心功能按钮样式 (故事、同步、个人中心)
   现代 SaaS 暗黑风格胶囊按钮
   ========================================= */
.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    height: 30px; /* 统一高度，保持紧凑感 */
    box-sizing: border-box;
    line-height: 1;
}

.header-action-btn:hover {
    background-color: var(--bg-interactive);
    border-color: var(--border-focus); /* 悬停时边框微微亮起，增强互动感 */
    color: #ffffff;
}

.header-action-btn:active {
    transform: scale(0.97); /* 点击时微缩回弹 */
}

.header-action-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-only {
    display: none !important;
}

/* =========================================
   搜索面板专属样式覆盖
   ========================================= */
#searchModalOverlay {
    /* 完全移除模糊效果，让画布保持绝对清晰 */
    /* backdrop-filter: none !important; */
    
    /* 备注：如果你还是希望有一点点极微弱的景深感，
       可以把上面那行换成：backdrop-filter: blur(1px) !important; */
	backdrop-filter: blur(1px) !important;
}
/* ==================== Choice 序号标签样式 ==================== */
.choice-index-label {
    color: var(--text-muted);
    font-size: 0.9em;
    width: 18px;            /* 固定宽度使两位数也能对齐 */
    text-align: right;
    flex-shrink: 0;
    user-select: none;      /* 防止拖拽或双击时被选中 */
    margin-right: 4px;
    line-height: 1.5;
}

/* ==================== 下拉菜单按钮禁用状态 ==================== */
.dropdown-content button:disabled { 
    opacity: 0.4; 
    cursor: not-allowed; 
}
/* ==================== 小地图 (Minimap) 样式 ==================== */
.minimap-container {
    position: fixed;
    bottom: 60px; /* 位于右下角控制栏的上方 */
    right: 10px;
    width: 220px;
    height: 150px;
    background: rgba(30, 30, 30, 0.75);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    z-index: 99;
    pointer-events: auto; /* 【修改】：改为 auto，允许响应鼠标和触摸事件 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    backdrop-filter: blur(4px);
}
.minimap-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#minimapCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 5px;
    cursor: pointer; /* 【新增】：增加点击手势提示 */
}
/* =========================================
   新增：全屏编辑器左侧行划选区域 (Gutter) 与移动端优化
   ========================================= */

/* 侧边选择栏（Gutter） */
.line-selector-gutter {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 22px;
    background-color: rgba(0, 0, 0, 0.15);
    border-right: 1px solid var(--border-secondary);
    cursor: text;
    z-index: 10;
    transition: background-color 0.2s;
}
.line-selector-gutter:hover {
    background-color: rgba(0, 122, 204, 0.2); /* 鼠标悬停微亮 */
}
.line-selector-gutter.active {
    background-color: rgba(0, 122, 204, 0.4); /* 拖拽时高亮 */
}

/* 配合 Gutter 的 Textarea 样式 */
.node.fullscreen-active .node-content {
    position: relative;
}
.node.fullscreen-active textarea {
    padding-left: 30px !important; /* 强制为左侧 Gutter 留出空间 */
}
/* ==================== 极简自动保存指示灯 ==================== */
.auto-save-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 12px;
    pointer-events: auto; /* 允许鼠标悬停查看 title 提示 */
    flex-shrink: 0;
    transition: background-color 0.8s ease, box-shadow 0.8s ease; /* 0.8秒平滑过渡，柔和自然 */
    opacity: 1 !important; /* 强制始终显示，覆盖原有的淡入淡出逻辑 */
}

/* 1 & 4. 已保存状态 (幽暗绿 + 极微弱光晕) */
.auto-save-indicator.indicator-saved {
    background-color: rgba(76, 175, 80, 0.35); 
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.2);
}

/* 2. 保存中/编辑中状态 (幽暗琥珀色 + 极微弱光晕) */
.auto-save-indicator.indicator-saving {
    background-color: rgba(255, 152, 0, 0.45); 
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.25);
}
/* 敏感词高亮样式 */
.highlight-word {
	border-bottom: 2px solid var(--accent-danger, #e53e3e);
	cursor: pointer;
	border-radius: 3px;
	padding: 1px 2px;
	background-color: rgba(229, 62, 62, 0.15);
	color: var(--accent-danger, #e53e3e);
	font-weight: 600;
	transition: all 0.2s ease;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}
.highlight-word:hover {
	background-color: rgba(229, 62, 62, 0.3);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	z-index: 10;
}
/* =========================================
   SWC 检测模式 (防误触隔离层 & 精准排版)
   ========================================= */

/* 1. 排版对齐：完美复刻文本框属性，并避开左侧 Gutter */
.swc-preview-area {
    position: absolute;
    inset: 0;
    padding: 6px;
    padding-left: 30px !important; /* 精确对应 fullscreen textarea 的 padding-left */
    background: var(--bg-primary);
    z-index: 9; /* 位于文本框之上，但位于 Gutter (10) 之下 */
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
    font-size: 0.95rem; /* 精确对应 fullscreen textarea */
    font-family: auto;
    line-height: 1.4;
    overflow-y: auto;
}

/* 2. 防误触隔离：进入该模式后，视觉弱化并禁用其他操作 */
.node.swc-mode-active {
    box-shadow: 0 0 0 2px var(--accent-danger), 0 10px 40px rgba(0,0,0,0.8) !important;
	z-index: 1002 !important;
}

.node.swc-mode-active .line-selector-gutter {
    pointer-events: none; /* 禁用划选行 */
    opacity: 0.3;
}

/* 禁用顶部工具栏除检测按钮外的所有功能（连保存退出也必须禁用，强迫用户先退出检测模式） */
.node.swc-mode-active .node-actions .node-action:not(.swc-check-btn) {
    opacity: 0.15;
    pointer-events: none;
}


/* =========================================
   SWC 敏感词操作弹窗 (现代化 UI)
   ========================================= */
.swc-popover {
    position: fixed;
    z-index: 10005; /* 确保高于所有全屏节点 */
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.7);
    width: 320px;
    padding: 16px;
    flex-direction: column;
    gap: 12px;
}
.swc-popover-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    border-bottom: 1px solid var(--border-secondary); padding-bottom: 10px; margin-bottom: 4px;
}
.swc-pop-title-col { display: flex; flex-direction: column; gap: 4px; }
.swc-pop-word { font-size: 1.25rem; font-weight: 700; color: var(--accent-danger); letter-spacing: 0.5px; }
.swc-pop-category { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.swc-pop-close {
    background: var(--bg-interactive); border: none; color: var(--text-muted);
    border-radius: 50%; width: 26px; height: 26px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 0.85rem; transition: 0.2s;
}
.swc-pop-close:hover { background: var(--accent-danger); color: white; }

.swc-batch-label {
    display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer;
    background: rgba(79, 201, 255, 0.1); padding: 8px 12px; border-radius: 6px;
    color: var(--text-primary); border: 1px solid rgba(79, 201, 255, 0.2); transition: 0.2s;
}
.swc-batch-label:hover { background: rgba(79, 201, 255, 0.15); }
#swc-batch-count { color: #4fc9ff; font-weight: bold; }

.swc-pop-section-title { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600; }
.swc-pop-suggestions { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }

/* 推荐按钮 */
.swc-sug-btn {
    padding: 6px 12px; font-size: 0.85rem; background: var(--bg-interactive); 
    border: 1px solid var(--border-primary); color: var(--text-primary); 
    border-radius: 4px; cursor: pointer; transition: 0.2s; font-weight: 500;
}
.swc-sug-btn:hover { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

.swc-pop-custom-input-group {
    display: flex; flex-wrap: nowrap; align-items: stretch; border: 1px solid var(--border-primary); border-radius: 6px; overflow: hidden;
}
.swc-pop-custom-input-group input {
    flex: 1; min-width: 0; background: var(--bg-primary); border: none; color: var(--text-primary);
    padding: 8px 12px; outline: none; font-size: 0.9rem;
}
.swc-pop-custom-input-group button {
    flex-shrink: 0; white-space: nowrap; display: flex; align-items: center; justify-content: center;
    background: var(--bg-interactive); color: white; border: none; padding: 0 16px;
    cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: 0.2s;
}
.swc-pop-custom-input-group button:hover { background: var(--accent-primary); }

.swc-pop-footer {
    padding-top: 12px; margin-top: 6px; border-top: 1px dashed var(--border-secondary);
}
.swc-pop-footer button {
    background: none; border: none; color: var(--text-muted); font-size: 0.85rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    width: 100%; gap: 6px; transition: 0.2s;
}
.swc-pop-footer button:hover { color: var(--accent-success); }
.swc-pop-footer span { font-size: 1.1rem; }
/* 确保敏感词的修改弹窗也在最顶层，避免被任何元素遮挡 */
#swc-popover {
    z-index: 1003 !important;
}
/* ===== 节点动作栏分组基础样式 (保障PC端正常水平排列) ===== */
.node-actions.responsive-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.node-tools-secondary, 
.node-tools-primary {
    display: flex;
    align-items: center;
    gap: 10px; /* 【商用优化2：PC端】拉宽各功能按钮之间的间距，增加视觉呼吸感 */
}
.mobile-hide-separator {
    width: 1px; 
    background-color: rgba(255, 255, 255, 0.15); /* 让分割线更柔和一点 */
    margin: 0 8px; /* 【商用优化2：PC端】增加竖向分割线两侧的留白 */
    height: 16px;
}
/* ==================== 节点路径追踪高亮特效 (商用发光效果) ==================== */
.node.path-highlight {
    box-shadow: 0 0 0 3px #f6e05e, 0 8px 30px rgba(246, 224, 94, 0.5) !important;
    border-color: #f6e05e !important;
    transition: all 0.3s ease;
    z-index: 100 !important;
}
.connection-line.path-highlight {
    stroke: #f6e05e !important;
    filter: drop-shadow(0 0 8px rgba(246, 224, 94, 0.9));
    opacity: 1 !important;
}
.preview-choice.path-highlight, .choice.path-highlight {
    background-color: rgba(246, 224, 94, 0.18) !important;
    border-color: #f6e05e !important;
    box-shadow: 0 0 10px rgba(246, 224, 94, 0.4) inset !important;
    border-radius: 4px;
    transition: all 0.3s ease;
}
/* =========================================
   新增：跨故事全局笔记本样式
   ========================================= */
.notebook-container {
    position: fixed;
    bottom: 60px; /* 紧贴在右下角工具栏之上 */
    right: 10px;
    width: 380px; /* 默认宽度 */
    height: 280px; /* 默认高度 */
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    z-index: 150;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
}

.notebook-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.notebook-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 26px;
    height: 26px;
    /* 移除之前的渐变背景，使用透明底色 */
    background: transparent;
    border-top-left-radius: 8px; 
    cursor: nwse-resize;
    z-index: 151;
    user-select: none;
    
    /* 调整符号的外观：低调的颜色与合适的大小 */
    color: var(--text-muted); /* 默认低调暗色 */
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 4px;
    padding-left: 4px;
    transition: color 0.15s ease; /* 平滑过渡颜色 */
}

.notebook-resize-handle:hover {
    /* 鼠标悬浮时亮起主题色，移除原来的 filter 亮度放大 */
    color: var(--accent-primary); 
}

.notebook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 5px 4px 18px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-primary);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    user-select: none;
}

#notebook-textarea {
    flex: 1;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    padding: 6px;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
	font-family: auto;
}
/* =========================================
   新增：现代化下拉菜单双列网格布局
   ========================================= */
.menu-grid-container {
    /* 【核心修复】：删除原有的 display: grid !important; 防止菜单被强制永久显示 */
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 320px;
    padding: 8px !important;
    right: 0;
}

/* 【核心修复】：区分触屏与鼠标设备，防止移动端 Hover 粘滞 */
@media (hover: hover) {
    .dropdown:hover .dropdown-content.menu-grid-container {
        display: grid !important;
    }
}
.dropdown-content.menu-grid-container.show {
    display: grid !important;
}

.menu-grid-container button {
    width: 100%;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    justify-content: flex-start;
}

/* 横跨两列的满宽按钮 */
.menu-grid-container .menu-full-width {
    grid-column: 1 / -1;
}

/* 个人中心的高亮特异化样式 */
.menu-grid-container .menu-highlight {
    background-color: rgba(0, 122, 204, 0.15) !important;
    border: 1px solid rgba(0, 122, 204, 0.3) !important;
    color: #4fc9ff !important;
    justify-content: center;
    font-weight: bold;
}
.menu-grid-container .menu-highlight:hover {
    background-color: var(--accent-primary) !important;
    color: white !important;
}

/* 网格内部分割线 */
.menu-grid-container .menu-divider {
    grid-column: 1 / -1;
    height: 1px;
    background-color: var(--border-primary);
    margin: 4px 0;
}
/* =========================================
   新增：流程图模块配套样式
   ========================================= */
.fc-tool-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 1.2rem;
}
.fc-tool-btn:hover { background: var(--bg-interactive); }
.fc-tool-btn:active { background: var(--bg-interactive-hover); }

/* 文本编辑器内的流程图占位组件 */
.flowchart-container {
    margin: 8px 0;
    padding: 10px;
    background: rgba(0, 122, 204, 0.05);
    border: 1px solid var(--border-focus);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.flowchart-container:hover {
    background: rgba(0, 122, 204, 0.15);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.2);
}

/* =========================================
   移动端 (手机/小屏幕) 专属适配代码
   ========================================= */
@media (max-width: 768px) {
    /* 头部栏改为横向滑动，防止换行导致占用过多空间 */
    header {
        padding: 6px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch; /* 让 iOS 滑动更流畅 */
    }
	.header-action-btn .btn-text {
        display: none; /* 手机端隐藏“已同步”、“个人中心”文字 */
    }
    .header-action-btn {
        padding: 0 5px; /* 缩小两侧边距 */
        gap: 2px;
    }
    /* 故事名称在手机端需要保留，但限制最大宽度防止撑破屏幕 */
    #storyManagerBtn #currentStoryName {
		max-width: 4em; 
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		display: inline-block;
		vertical-align: bottom;
	}
    
    /* 隐藏标题文本，只保留 Logo 图标 */
    .logo { margin-right: 12px; }
    .logo h3 {
        display: block;
        font-size: 1.1rem;
    }
    
    /* 工具栏按钮排列更紧密 */
    .controls { flex-wrap: nowrap; gap: 1px; align-items: center;}
    .btn { padding: 4px 6px; }
    
    /* 隐藏常规按钮里的文字，仅显示图标 (下拉菜单除外) */
    .btn span.btn-text { display: none; }
	.dropdown-content {
        position: fixed !important; /* 改为基于屏幕定位，突破 overflow-x 裁切 */
        top: 45px !important;
        right: 10px !important;
        left: auto !important;
    }
    
    /* 节点卡片在手机端适当变窄 */
    .node { width: 230px; }
    
    /* 缩放控制器挪到避免遮挡的位置 */
    .zoom-controls { bottom: 35px; right: 5px; }
	
	.current-story-indicator { margin-left: 1px;}
    .current-story-indicator span { max-width: 90px; }

	/* =========================================
       [新增] 个人中心 (Profile) 移动端专属适配 
       ========================================= */
    .modal-content { 
        padding: 18px; 
        width: 95%; 
        max-height: 85vh;
    }
    .profile-modal-content { 
        padding: 10px; 
    }
    
    /* 顶部导航 Tabs 横向滚动 */
    .profile-tabs { 
        white-space: nowrap; 
        -webkit-overflow-scrolling: touch; /* iOS 顺滑滚动 */
        padding-bottom: 5px; 
    }
    .profile-tabs .tab-btn { 
        flex: 0 0 auto; 
        padding: 8px 12px; 
    }
    
    /* 基础信息双列变单列 */
    .info-grid { 
        grid-template-columns: 1fr; 
        gap: 12px; 
    }
    
    /* 邀请区域左右排版变上下排版 */
    .referral-compact { 
        flex-direction: column; 
        align-items: center; 
        text-align: center; 
    }
    .referral-compact .qr-box { 
        margin-bottom: 10px; 
    }
    .referral-compact .referral-links { 
        width: 100%; 
        box-sizing: border-box; 
    }
    
    /* 输入框与按钮紧凑化 */
    .copy-group { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 8px; 
    }
    .copy-group .btn-secondary { 
        width: 100%; 
    }
    .input-group {
        flex-direction: column;
    }
    .input-group button {
        width: 100%;
    }
    
    /* 积分展示区域压缩 */
    .credit-hero { 
        padding: 15px; 
    }
    .credit-details { 
        flex-direction: column; 
        gap: 8px; 
        align-items: center; 
    }
	
	.desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: flex !important;
    }
	.auth-wrapper {
        flex-direction: column;
        max-width: 450px;
        margin: auto; /* 移除原本固定的 40px auto，配合外层的 margin: auto 统一管理居中 */
        width: 90%;
    }
    .auth-marketing {
        padding: 30px 25px;
        border-right: none;
        order: 2; /* 移动端让销售信在下方，避免遮挡登录框 */
    }
    .auth-container {
        padding: 30px 25px;
        order: 1; /* 登录框强制排在上方，无需滚动即可操作 */
        border-bottom: 1px solid var(--border-primary);
    }
    .brand-title { font-size: 1.8rem; color: #ff9800; }
	/* 移动端全屏卡片紧凑样式 */
	/* 隐藏次要的间隔竖线 */
    .mobile-hide-separator { 
        display: none !important; 
    }
    
    /* =========================================
       移动端全屏卡片双行显示优化 (Grid布局)
       ========================================= */
    .node.fullscreen-active .node-header {
        display: grid;
        grid-template-columns: 1fr auto; /* 左侧标题拉伸，右侧首行按钮自适应 */
        gap: 8px 5px;
        align-items: center;
        padding-bottom: 8px; /* 增加与正文的呼吸感 */
        margin-bottom: 8px;
    }
    .node.fullscreen-active .node-actions { 
        display: contents; /* 使分组直接参与顶层网格布局（解除Flex盒束缚） */
    }
    .node.fullscreen-active .node-title {
        grid-column: 1 / 2;
        grid-row: 1;
    }
    .node.fullscreen-active .node-tools-primary {
        grid-column: 2 / 3;
        grid-row: 1;
        display: flex;
        align-items: center;
        gap: 6px; /* 保留第一行的适当间距 */
    }
    .node.fullscreen-active .node-tools-secondary {
        grid-column: 1 / 3; /* 横跨两列 */
        grid-row: 2; /* 强制下放到第二行 */
        display: flex;
        justify-content: center; /* 居中对齐第二行所有按钮 */
        align-items: center;
        gap: 18px; /* 大幅增加按钮间距，防止触屏误触 */
        width: 100%;
        position: relative; /* 为分割线提供绝对定位基准 */
    }
    
    /* 【商用优化1：手机端】新增：两行之间的优雅渐隐分割线 */
    .node.fullscreen-active .node-tools-secondary::before {
        content: '';
        position: absolute;
        top: -4px;
        left: 2%;
        width: 96%;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
        pointer-events: none; /* 防止阻挡下方按钮的点击判定 */
    }
    .node.fullscreen-active .node-action { 
        width: 28px; /* 适当放大触控区域 */
        height: 28px; 
    }
    .node.fullscreen-active .auto-save-indicator {
        margin-right: 0 !important; /* 解除原有强制边距，依靠 gap 自动排列 */
    }
    
    /* 自动保存提示更加低调 */
    .auto-save-indicator {
        font-size: 0.7rem !important;
        margin-right: 4px !important;
    }
    
    /* 极限压缩时隐藏“已保存/保存中”文字，只留图标 */
    .auto-save-indicator .text-part { 
        display: none; 
    }
	/* =========================================
       修改：移动端随身笔记本防遮挡
       ========================================= */
    .notebook-container {
        bottom: 80px; /* 抬高底线，彻底避开手机端下方的状态栏和右下角悬浮工具 */
        right: 5px;
    }
	.menu-grid-container {
        width: 290px; /* 移动端适当收窄 */
    }
}