/* 因果图谱页面样式 */

.graph-toolbar {
    background: var(--card, #fff);
    border: 1px solid var(--border, #eef2f7);
    border-radius: 10px;
    margin-bottom: 8px;
    box-sizing: border-box;
    overflow: hidden;
}

/* ====== 工具栏头部 ====== */
.toolbar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
    min-height: 32px;
    transition: padding 0.2s;
}
.graph-toolbar.collapsed .toolbar-header {
    border-bottom: none;
    border-radius: 10px;
}
.btn-toolbar-toggle {
    background: none;
    border: 0;
    cursor: pointer;
    padding: 2px 6px;
    color: #666;
    font-size: 13px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s;
}
.btn-toolbar-toggle:hover { background: #e5e7eb; color: #333; }
.toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
}
.graph-toolbar.collapsed .toggle-icon { transform: rotate(180deg); }
.toolbar-title {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
}

/* 状态提示：放在工具栏头部右侧 */
.graph-status-inline {
    margin-left: auto;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
    text-align: right;
}
.graph-status-inline.error {
    color: #dc2626;
    font-weight: 600;
}

/* ====== 跟随移动开关（始终显示在工具栏头部） ====== */
.follow-move-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 8px;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    font-size: 12px;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.follow-move-switch:hover {
    border-color: #6366f1;
    color: #4338ca;
}
.follow-move-switch input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    accent-color: #6366f1;
}
.follow-move-switch.active {
    background: #eef2ff;
    border-color: #6366f1;
    color: #4338ca;
    font-weight: 600;
}
/* Ctrl 临时按下态：橘色高亮，提示「这是临时的、不是开关打开的」 */
.follow-move-switch.ctrl-hold {
    background: #fff7ed;
    border-color: #f97316;
    color: #c2410c;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
    animation: followMoveCtrlPulse 1.2s ease-in-out infinite;
}
@keyframes followMoveCtrlPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15); }
    50%      { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.30); }
}
.follow-move-text {
    line-height: 1;
}
.follow-move-ctrl-hint {
    display: none;
    padding: 1px 6px;
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 4px;
    line-height: 1;
}
/* 当开关未激活时，显示「按住 Ctrl」提示，提醒用户有这个快捷方式 */
.follow-move-switch:not(.active):not(.ctrl-hold) .follow-move-ctrl-hint {
    display: inline-block;
}

/* ====== 工具栏内容区（可折叠） ====== */
.toolbar-body {
    padding: 8px 10px;
    transition: all 0.25s;
    overflow: hidden;
}
.graph-toolbar.collapsed .toolbar-body {
    padding: 0 10px;
    max-height: 0;
    opacity: 0;
}

/* ====== 旧 graph-status 保留兼容 ====== */
.graph-status {
    display: none; /* 已被 .graph-status-inline 替代 */
}

.graph-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px 0;
}
.graph-search label { color: #555; font-size: 12px; }
.graph-search select,
.graph-search input[type="number"] {
    padding: 4px 6px;
    border: 1px solid #d6dde6;
    border-radius: 5px;
    font-size: 12px;
    background: #fff;
}
.graph-search input[type="number"] { width: 70px; }
.btn-search {
    padding: 4px 10px;
    background: #2b6cb0;
    color: #fff;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}
.btn-search:hover { background: #265a93; }
.btn-name-search {
    color: #2b6cb0;
    text-decoration: none;
    font-size: 12px;
    padding: 4px 6px;
}
.btn-name-search:hover { text-decoration: underline; }

.graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: #666;
    padding-top: 6px;
    border-top: 1px dashed #eaeef3;
}
.legend-item::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    border-radius: 3px;
    vertical-align: middle;
}
.legend-factor::before  { background: #f59e0b; }
.legend-symptom::before { background: #ef4444; }
.legend-food::before    { background: #10b981; }
.legend-acupoint::before{ background: #8b5cf6; }
.legend-intervention::before { background: #06b6d4; }
.legend-edge-causes::before  { background: #ef4444; border-radius: 0; height: 2px; margin-top: 5px; }
.legend-edge-indirect::before { background: repeating-linear-gradient(90deg, #ef4444 0 5px, transparent 5px 8px); border-radius: 0; height: 2px; margin-top: 5px; }
.legend-edge-treats::before  { background: #10b981; border-radius: 0; height: 2px; margin-top: 5px; }
.legend-edge-regulates::before{ background: #3b82f6; border-radius: 0; height: 2px; margin-top: 5px; }

/* 关系类型过滤 */
.graph-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-left: auto;       /* 紧贴右侧 */
    padding: 4px 8px;
    background: #f8fafc;
    border: 1px solid #e5e9f0;
    border-radius: 6px;
    flex-shrink: 0;
}
.filters-label {
    font-size: 11px;
    color: #475569;
    margin-right: 2px;
    font-weight: 600;
}
.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    user-select: none;
    padding: 1px 5px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.filter-checkbox:hover {
    color: #4338ca;
    border-color: #c7d2fe;
    background: #eef2ff;
}
.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
    accent-color: #6366f1;
}
.btn-reset-filters {
    margin-left: 4px;
    padding: 2px 6px;
    font-size: 13px;
    line-height: 1;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-reset-filters:hover {
    background: #eef2ff;
    color: #4338ca;
    border-color: #6366f1;
}

/* 工具栏第二行：图例 + 过滤项（同一行，flex） */
.toolbar-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.toolbar-row-legend {
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px dashed #eaeef3;
}

/* 旧 graph-status 已用 .graph-status-inline 替代，保留兼容 */
.graph-status {
    display: none;
}
/* .graph-status.error 也废弃 */

/* 连线模式 */
.btn-connect-mode {
    padding: 3px 10px;
    border: 1.5px dashed #f59e0b;
    border-radius: 5px;
    background: #fffbeb;
    color: #92400e;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-connect-mode:hover {
    background: #fef3c7;
    border-color: #d97706;
}
.btn-connect-mode.active {
    background: #f59e0b;
    color: #fff;
    border-color: #d97706;
    border-style: solid;
    box-shadow: 0 0 8px rgba(245,158,11,0.5);
}

/* 临时连线 */
.connect-temp-line {
    stroke: #f59e0b;
    stroke-width: 2.5;
    stroke-dasharray: 8,4;
    pointer-events: none;
    opacity: 0.8;
}

/* 连线起点高亮 */
.node-g.connect-source rect {
    stroke: #f59e0b;
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgba(245,158,11,0.5));
}

/* 连线弹窗 */
.connect-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
}
.connect-modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
}
.connect-modal-box {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    min-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 1;
}
.connect-modal-box h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #333;
}
.connect-info {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}
.connect-modal-box label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
    margin-top: 12px;
}
.connect-modal-box select,
.connect-modal-box textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}
.connect-modal-box textarea {
    resize: vertical;
    font-family: inherit;
}
.connect-modal-btns {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}
.connect-modal-btns button {
    padding: 8px 18px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
#btnConnectSubmit {
    background: #10b981;
    color: #fff;
}
#btnConnectSubmit:hover {
    background: #059669;
}
.connect-modal-btns button:last-child {
    background: #e5e7eb;
    color: #374151;
}

/* 力导向布局对话框的预设按钮 */
.connect-modal-btn-preset {
    padding: 4px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
}
.connect-modal-btn-preset:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #94a3b8;
}

.graph-stage {
    position: relative;
    background: linear-gradient(135deg, #fafbff 0%, #f3f5fb 100%);
    border: 1px solid var(--border, #eef2f7);
    border-radius: 10px;
    overflow: hidden;
    box-sizing: border-box;
    min-height: 640px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
/* 说明区隐藏时，下方空白让 graph-stage 自动撑开
   只有当前页面的 .main-content-inner 含 .graph-stage 时才生效 */
.main-column:has(.graph-page-inner),
.main-content-inner.graph-page-inner {
    display: flex;
    flex-direction: column;
}
.main-content-inner.graph-page-inner {
    /* 占满 main-column 剩余高度，让 graph-stage 用 flex:1 自动撑开 */
    flex: 1;
    min-height: 0;  /* 关键：允许 flex 子元素收缩 */
}
#graphSvg {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 640px;
    cursor: grab;
    user-select: none;
    flex: 1;
}
#graphSvg:active { cursor: grabbing; }

.graph-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.85);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.graph-controls button {
    width: 32px;
    height: 32px;
    border: 1px solid #d6dde6;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    color: #333;
}
.graph-controls button:hover { background: #f0f4fa; }

/* 悬停聚焦效果 */
.node-g {
    transition: opacity 0.2s ease-in-out;
}
.edge-line, .edge-label {
    transition: opacity 0.2s ease-in-out;
}
.node-g.fade,
.edge-line.fade,
.edge-label.fade {
    opacity: 0.1 !important;
}

/* 节点样式 */
.node-rect { transition: stroke-width .15s, filter .15s; }
.node-rect:hover { stroke-width: 3px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.node-rect.center { stroke: #111; stroke-width: 2.5; }
.node-rect.factor   { fill: #fff7ed; stroke: #f59e0b; }
.node-rect.symptom  { fill: #fef2f2; stroke: #ef4444; }
.node-rect.food     { fill: #ecfdf5; stroke: #10b981; }
.node-rect.acupoint { fill: #f5f3ff; stroke: #8b5cf6; }
.node-rect.intervention { fill: #ecfeff; stroke: #06b6d4; }
.node-text {
    font-size: 13px;
    font-weight: 500;
    fill: #222;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}
.node-text.center { font-weight: 700; font-size: 14px; }
.node-sub {
    font-size: 10px;
    fill: #888;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}
/* 展开指示器 */
.expand-indicator {
    fill: #10b981;
    stroke: #fff;
    stroke-width: 2;
    cursor: pointer;
}
.expand-indicator-text {
    font-size: 10px;
    font-weight: bold;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}
.node-g { cursor: pointer; }
.node-g.dragging { cursor: grabbing; opacity: 0.85; }
.node-g.dragging .node-rect { stroke-width: 3px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.3)); }

/* 边样式 */
.edge-line { fill: none; stroke-width: calc(1.6 * var(--gc-edge-scale, 1)); }
.edge-line.causes   { stroke: #ef4444; }
.edge-line.treats   { stroke: #10b981; }
.edge-line.regulates{ stroke: #3b82f6; }
.edge-line.aggravates { stroke: #f59e0b; }
.edge-line.associated { stroke: #8b5cf6; }
.edge-line.indirect { stroke-dasharray: 6 4; stroke-width: calc(1.3 * var(--gc-edge-scale, 1)); opacity: 0.75; }
.edge-line:hover { stroke-width: calc(2.5 * var(--gc-edge-scale, 1)); }

/* 证据等级视觉化（叠加在边颜色之上） */
.edge-line.ev-clinical_guideline { stroke-width: calc(2.6 * var(--gc-edge-scale, 1)); opacity: 1; }   /* 强：粗实线 */
.edge-line.ev-randomized_trial   { stroke-width: calc(2.4 * var(--gc-edge-scale, 1)); opacity: 1; }   /* 强：粗实线 */
.edge-line.ev-meta_analysis      { stroke-width: calc(2.4 * var(--gc-edge-scale, 1)); opacity: 1; }   /* 强：粗实线 */
.edge-line.ev-cohort_study       { stroke-width: calc(2.0 * var(--gc-edge-scale, 1)); opacity: 0.95; }/* 中：稍粗实线 */
.edge-line.ev-animal_study       { stroke-dasharray: 5 3; stroke-width: calc(1.6 * var(--gc-edge-scale, 1)); opacity: 0.85; } /* 弱：短虚线 */
.edge-line.ev-in_vitro           { stroke-dasharray: 2 3; stroke-width: calc(1.4 * var(--gc-edge-scale, 1)); opacity: 0.75; } /* 弱：点线 */
.edge-line.ev-traditional_use    { stroke-dasharray: 7 3 1 3; stroke-width: calc(1.5 * var(--gc-edge-scale, 1)); opacity: 0.85; } /* 传统：点划线 */
.edge-line.ev-expert_opinion     { stroke-dasharray: 3 3; stroke-width: calc(1.4 * var(--gc-edge-scale, 1)); opacity: 0.7; }   /* 主观：细虚线 */
.edge-line.ev-unknown            { opacity: 0.45; }                  /* 未分类：淡色 */

/* 证据等级图例（工具栏） */
.legend-divider { color: #cbd5e1; margin: 0 4px; font-weight: 700; }
.legend-item.legend-evidence      { color: #1e293b; font-weight: 600; }
.legend-item.legend-evidence-evdash { color: #1e293b; font-weight: 600; }
.legend-item.legend-evidence-evdot  { color: #1e293b; font-weight: 600; }
.legend-item.legend-evidence-evunknown { color: #94a3b8; font-weight: 500; }
.edge-label {
    font-size: 10px;
    fill: #777;
    pointer-events: none;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3;
}

.graph-detail {
    background: var(--card, #fff);
    border: 1px solid var(--border, #eef2f7);
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 14px;
    font-size: 13px;
    color: #555;
    line-height: 1.7;
}
.graph-detail h3 { margin: 0 0 8px 0; font-size: 14px; color: #333; }
.graph-detail ul { margin: 0; padding-left: 20px; }

/* 节点高亮 - 选中态 */
.node-g.selected .node-rect { stroke-width: 3px; filter: drop-shadow(0 0 6px rgba(43,108,176,.4)); }

/* 边可点击 */
.edge-line { cursor: pointer; }

/* 侧边详情面板 */
.graph-detail-panel {
    position: absolute;
    top: 12px;
    right: 52px;
    width: 280px;
    max-height: 500px;
    background: rgba(255,255,255,0.97);
    border: 1px solid #d6dde6;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    overflow-y: auto;
    z-index: 10;
    font-size: 13px;
}
.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
    border-radius: 10px 10px 0 0;
}
.detail-panel-title { font-weight: 600; color: #333; }
.detail-panel-close {
    width: 24px; height: 24px;
    border: 0; background: none;
    font-size: 14px; color: #999;
    cursor: pointer; border-radius: 4px;
}
.detail-panel-close:hover { background: #f0f0f0; color: #333; }
.detail-panel-body { padding: 12px 14px; }
.detail-panel-body .dp-row { margin-bottom: 8px; }
.detail-panel-body .dp-label { color: #888; font-size: 11px; display: block; margin-bottom: 2px; }
.detail-panel-body .dp-value { color: #222; font-weight: 500; }
.detail-panel-body .dp-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
}
.dp-badge.factor   { background: #f59e0b; }
.dp-badge.symptom  { background: #ef4444; }
.dp-badge.food     { background: #10b981; }
.dp-badge.acupoint { background: #8b5cf6; }
.dp-badge.causes   { background: #ef4444; }
.dp-badge.treats   { background: #10b981; }
.dp-badge.regulates{ background: #3b82f6; }
.dp-badge.aggravates { background: #f59e0b; }
.dp-badge.associated { background: #8b5cf6; }
.detail-panel-body .dp-rel-list { list-style: none; padding: 0; margin: 6px 0 0 0; }
.detail-panel-body .dp-rel-list li {
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
}
.detail-panel-body .dp-rel-list li .dp-rel-dir { color: #888; font-size: 11px; }
.detail-panel-body a.dp-edit-link {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 10px;
    background: #2b6cb0;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
}
.detail-panel-body a.dp-edit-link:hover { background: #265a93; }
.detail-panel-body a.dp-delete-link {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 10px;
    background: #ef4444;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
}
.detail-panel-body a.dp-delete-link:hover { background: #dc2626; }
.detail-panel-body a.dp-list-link {
    color: #2b6cb0;
    text-decoration: none;
    font-size: 12px;
}
.detail-panel-body a.dp-list-link:hover { text-decoration: underline; }

/* 暗色主题 */
:root[data-pt-theme="dark"] .graph-stage,
body[data-pt-theme="dark"] .graph-stage {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}
:root[data-pt-theme="dark"] .graph-toolbar,
body[data-pt-theme="dark"] .graph-toolbar,
:root[data-pt-theme="dark"] .graph-detail,
body[data-pt-theme="dark"] .graph-detail {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
:root[data-pt-theme="dark"] .graph-status,
body[data-pt-theme="dark"] .graph-status {
    background: #0f172a;
    color: #94a3b8;
}
:root[data-pt-theme="dark"] .node-text,
body[data-pt-theme="dark"] .node-text { fill: #e2e8f0; }
:root[data-pt-theme="dark"] .node-sub,
body[data-pt-theme="dark"] .node-sub { fill: #94a3b8; }
:root[data-pt-theme="dark"] .edge-label,
body[data-pt-theme="dark"] .edge-label { fill: #94a3b8; stroke: #1e293b; }
:root[data-pt-theme="dark"] .node-rect.factor   { fill: #422006; stroke: #f59e0b; }
:root[data-pt-theme="dark"] .node-rect.symptom  { fill: #450a0a; stroke: #ef4444; }
:root[data-pt-theme="dark"] .node-rect.food     { fill: #052e1a; stroke: #10b981; }
:root[data-pt-theme="dark"] .node-rect.acupoint { fill: #2e1065; stroke: #8b5cf6; }
:root[data-pt-theme="dark"] .node-rect.intervention { fill: #083344; stroke: #06b6d4; }
:root[data-pt-theme="dark"] .graph-detail-panel,
body[data-pt-theme="dark"] .graph-detail-panel { background: rgba(30,41,59,0.97); border-color: #334155; }
:root[data-pt-theme="dark"] .detail-panel-header,
body[data-pt-theme="dark"] .detail-panel-header { background: #1e293b; border-color: #334155; }
:root[data-pt-theme="dark"] .detail-panel-title,
body[data-pt-theme="dark"] .detail-panel-title { color: #e2e8f0; }
:root[data-pt-theme="dark"] .detail-panel-body .dp-value,
body[data-pt-theme="dark"] .detail-panel-body .dp-value { color: #e2e8f0; }
:root[data-pt-theme="dark"] .detail-panel-body .dp-rel-list li,
body[data-pt-theme="dark"] .detail-panel-body .dp-rel-list li { background: #0f172a; border-color: #334155; }

/* AI 讨论按钮 */
.btn-ai-discuss {
    margin-left: auto;
    padding: 3px 10px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: opacity .15s;
}
.btn-ai-discuss:hover { opacity: 0.85; }
.btn-share-graph {
    margin-left: 4px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #06b6d4, #0e7490);
    color: #fff;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: opacity .15s;
}
.btn-share-graph:hover { opacity: 0.85; }

/* AI 讨论弹窗 */
.ai-discuss-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.ai-discuss-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.ai-discuss-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.ai-discuss-title { font-weight: 600; font-size: 16px; color: #333; }
.ai-discuss-close {
    width: 28px; height: 28px;
    border: 0; background: none;
    font-size: 16px; color: #999;
    cursor: pointer; border-radius: 4px;
}
.ai-discuss-close:hover { background: #f0f0f0; color: #333; }
.ai-discuss-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.ai-discuss-footer {
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}
.btn-ai-copy {
    flex: 1;
    padding: 10px;
    background: #10b981;
    color: #fff;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.btn-ai-copy:hover { background: #059669; }
.btn-ai-import {
    flex: 1;
    padding: 10px;
    background: #8b5cf6;
    color: #fff;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    line-height: 1.4;
}
.btn-ai-import:hover { background: #7c3aed; }

/* 复制节点坐标按钮 - 灰色调试风，不抢眼 */
.btn-copy-layout {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    margin-left: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}
.btn-copy-layout:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 显示/隐藏底部说明 按钮 - 中性灰色，不抢眼 */
.btn-toggle-desc {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    margin-left: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}
.btn-toggle-desc:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 力导向布局按钮 - 蓝色（重点功能） */
.btn-force-layout {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: #fff;
    border: 0;
    padding: 6px 12px;
    margin-left: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-force-layout:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}
.btn-force-layout:active {
    transform: translateY(0);
}

/* ============== 滑块 ============== */
.slider-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
}
.slider-row-inline {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.slider-label {
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
}
.slider-row input[type="range"] {
    width: 90px;
    cursor: pointer;
}
.slider-value {
    min-width: 36px;
    text-align: right;
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 12px;
    color: #1e293b;
    font-weight: 600;
}

/* 3D 工具栏滑块（竖排） */
.graph-3d-sliders {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.92);
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 5;
}
.graph-3d-sliders .slider-row {
    margin-left: 0;
    font-size: 11px;
    color: #1e293b;
}
.graph-3d-sliders .slider-row input[type="range"] {
    width: 110px;
}

/* ============== 3D 视图样式 ============== */
.btn-view-3d {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: 0;
    padding: 6px 12px;
    margin-left: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-view-3d:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.btn-view-3d.active {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
}

.graph-3d-container {
    position: relative;
    width: 100%;
    height: 640px;
    background: radial-gradient(ellipse at center, #1e293b 0%, #0f172a 100%);
    border-radius: 10px;
    overflow: hidden;
}
.graph-3d-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}
.graph-3d-container canvas:active {
    cursor: grabbing;
}
.graph-3d-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}
.graph-3d-controls button {
    background: rgba(255, 255, 255, 0.92);
    color: #1e293b;
    border: 0;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.15s;
}
.graph-3d-controls button:hover {
    background: #fff;
}
.graph-3d-controls button.active {
    background: #6366f1;
    color: #fff;
}
.graph-3d-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #e2e8f0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 5;
    pointer-events: none;
}
/* 3D 节点标签 - 用户反馈"文字遮挡住小球"：
   1) 文字放远一些（屏幕坐标向上偏移 32px）
   2) 字号小一点（11px）
   3) 半透明深色背景 + 圆角，视觉上像"飘在球上方的小标签"
*/
.graph-3d-label {
    position: absolute;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.78);
    padding: 2px 7px;
    border-radius: 8px;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -100%) translateY(-32px);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    z-index: 4;
}
.graph-3d-label.center {
    background: rgba(236, 72, 153, 0.9);
    font-size: 13px;
    font-weight: 700;
    transform: translate(-50%, -100%) translateY(-44px);
}
