/* ===== 全局重置与变量 ===== */
:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-primary: #2563eb;
  --color-primary-light: #dbeafe;
  --color-spine: #f59e0b;
  --color-branch: #10b981;
  --color-other: #94a3b8;
  --color-hard: #475569;
  --color-soft: #cbd5e1;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== 加载态 ===== */
.loading-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 顶部栏 ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
}

.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.progress-ring {
  position: relative;
  width: 40px;
  height: 40px;
}

.progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 3;
}

.ring-fg {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.4s ease;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
}

.goal-info {
  text-align: right;
}

.goal-title {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.goal-name {
  font-size: 12px;
  font-weight: 600;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== 主体布局 ===== */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 图谱面板 ===== */
.graph-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.panel-toolbar button {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.panel-toolbar button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.panel-toolbar button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.separator {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 4px;
}

.graph-body {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#graph-container {
  position: absolute;
  inset: 0;
}

.legend {
  display: flex;
  gap: 16px;
  padding: 6px 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-text-secondary);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-spine { background: var(--color-spine); }
.dot-branch { background: var(--color-branch); }
.dot-other { background: var(--color-other); }

.line {
  width: 20px;
  height: 2px;
  display: inline-block;
}

.line-hard { background: var(--color-hard); }
.line-soft { background: var(--color-soft); border-top: 1px dashed var(--color-text-secondary); height: 0; }

.legend-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== 详情面板 ===== */
.detail-panel {
  width: 380px;
  min-width: 380px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state h2 {
  font-size: 16px;
  color: var(--color-text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 4px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.detail-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--color-text-secondary);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

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

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

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.tag-layer { background: #f0fdf4; color: #166534; }
.tag-kind { background: #fef3c7; color: #92400e; }
.tag-path { background: #dbeafe; color: #1e40af; }

/* ===== 自评分 ===== */
.score-section {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.score-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
}

.score-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 3px;
  background: linear-gradient(to right, #ef4444, #f59e0b, #10b981);
  outline: none;
  cursor: pointer;
}

.score-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--color-primary);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.score-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* ===== 详情内容区 ===== */
.detail-section {
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

.detail-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.description {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--color-text);
}

.evidence {
  font-size: 13px;
  padding: 8px 12px;
  background: #fffbeb;
  border-left: 3px solid var(--color-warning);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #78350f;
}

/* ===== 示意图 ===== */
.diagram-box {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 10px;
}

.diagram-box svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== 资源列表（可点击） ===== */
.resource-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resource-list li {
  display: block;
}

.resource-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.resource-link:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.resource-link:active {
  transform: translateY(0);
}

.ext-icon {
  color: var(--color-primary);
  font-size: 11px;
  margin-left: 2px;
}

.resource-type {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 2px;
}

.resource-info {
  min-width: 0;
}

.resource-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.resource-note {
  font-size: 11.5px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* ===== 前置知识 ===== */
.prereq-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.prereq-tag:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.prereq-score {
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
}

.prereq-score.score-high { background: #d1fae5; color: #065f46; }
.prereq-score.score-mid { background: #fef3c7; color: #92400e; }
.prereq-score.score-low { background: #fee2e2; color: #991b1b; }

/* ===== 练习任务 ===== */
.task-card {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.task-level {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--color-primary);
  color: white;
  border-radius: 4px;
}

.task-title {
  font-size: 13px;
  font-weight: 600;
}

.task-instructions {
  font-size: 12.5px;
  color: var(--color-text);
  white-space: pre-line;
  line-height: 1.6;
  margin-bottom: 8px;
}

.task-criteria {
  font-size: 12px;
  color: var(--color-text-secondary);
  padding-top: 6px;
  border-top: 1px dashed var(--color-border);
}

/* ===== 各层进度条 ===== */
.layer-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.layer-name {
  font-size: 12px;
  width: 52px;
  flex-shrink: 0;
  color: var(--color-text);
}

.layer-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.layer-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.layer-percent {
  font-size: 11px;
  width: 32px;
  text-align: right;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.readiness-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.readiness-level {
  font-size: 12px;
  font-weight: 600;
  width: 60px;
}

.readiness-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.readiness-status.ready {
  background: #d1fae5;
  color: #065f46;
}

.readiness-status.not-ready {
  background: #fee2e2;
  color: #991b1b;
}

.readiness-detail {
  font-size: 11px;
  color: var(--color-text-secondary);
  flex: 1;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  .main {
    flex-direction: column;
    overflow: visible;
  }
  .graph-panel {
    height: 60vh;
    min-height: 340px;
    flex: none;
  }
  .detail-panel {
    width: 100%;
    min-width: unset;
    border-left: none;
    border-top: 1px solid var(--color-border);
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .goal-info {
    text-align: left;
  }
}


/* ============================================================
   下面是「多论文版」新增的样式
   （论文库切换 / DOI 导入 / 三页签 / 相关文献 / 导出弹窗）
   改颜色只改这里的变量，别到下面一条条找。
   ============================================================ */
:root {
  /* 自动生成模式下三种节点角色的颜色，要和 js/app.js 里 GROUP_COLORS 对齐 */
  --color-seed: #2563eb;
  --color-seed-bg: #dbeafe;
  --color-prereq: #94a3b8;
  --color-prereq-bg: #f1f5f9;
  --color-frontier: #c026d3;
  --color-frontier-bg: #fae8ff;
  --color-unselected: #e2e8f0;
}

/* ===== 通用按钮 ===== */
.btn {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ===== 顶部栏：论文库选择器 ===== */
.paper-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.paper-select {
  max-width: 260px;
  font-size: 12.5px;
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}

.paper-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ===== DOI 导入面板 ===== */
.import-panel {
  margin: 0 24px 12px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.import-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.import-head h2 {
  font-size: 14px;
  font-weight: 700;
}

.import-hint {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}

.import-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.import-input {
  flex: 1;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: Consolas, "Courier New", monospace;
}

.import-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.import-note {
  font-size: 11.5px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  padding: 8px 10px;
  background: #f8fafc;
  border-left: 3px solid var(--color-warning);
  border-radius: 0 4px 4px 0;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
  background: #f1f5f9;
  padding: 1px 4px;
  border-radius: 3px;
  color: #be185d;
}

/* ===== 忙碌态 / 提示条 ===== */
.busy-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  font-size: 12.5px;
  color: var(--color-text-secondary);
}

.busy-box .loading-spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
  flex-shrink: 0;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 24px 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  border-radius: var(--radius);
  border-left: 3px solid;
}

.alert-error {
  background: #fef2f2;
  border-color: var(--color-danger);
  color: #991b1b;
}

.alert-ok {
  background: #f0fdf4;
  border-color: var(--color-success);
  color: #166534;
}

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
}

.alert-close:hover { opacity: 1; }

.warn-box {
  font-size: 11.5px;
  line-height: 1.7;
  color: #92400e;
  background: #fffbeb;
  border-left: 3px solid var(--color-warning);
  padding: 8px 10px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 10px;
}

.empty-hint {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ===== 右侧面板：三页签 ===== */
/* 覆盖上面 .detail-panel 的内边距，改由页签内容区自己控制 */
.detail-panel {
  width: 440px;
  min-width: 440px;
  padding: 0;
  gap: 0;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.tabs button {
  position: relative;
  font-size: 12.5px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.tabs button:hover { color: var(--color-primary); }

.tabs button.active {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-primary);
  font-weight: 600;
  /* 用一条白线盖住页签下的边框，做出「连成一体」的效果 */
  box-shadow: inset 0 2px 0 var(--color-primary);
  margin-bottom: -1px;
  padding-bottom: 8px;
}

.tab-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-left: 5px;
  vertical-align: middle;
}

.tab-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 5px;
  font-size: 10.5px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

.tab-body {
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== 图例：新角色圆点 ===== */
.dot-seed { background: var(--color-seed); }
.dot-prereq { background: var(--color-prereq); }
.dot-frontier { background: var(--color-frontier); }
.dot-unselected { background: #fff; border: 1px dashed var(--color-unselected); }

/* ===== 论文题录卡 ===== */
.paper-card {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.badge-auto { background: var(--color-seed-bg); color: #1e40af; }
.badge-curated { background: #fef3c7; color: #92400e; }
.badge-tier { background: #f1f5f9; color: var(--color-text-secondary); }
.badge-pool { background: #f0fdf4; color: #166534; }
.badge-oa { background: #d1fae5; color: #065f46; }

.paper-title {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
}

.paper-title a {
  color: var(--color-text);
  text-decoration: none;
}

.paper-title a:hover { color: var(--color-primary); }

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11.5px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.paper-doi {
  font-family: Consolas, "Courier New", monospace;
}

.paper-authors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.author-chip {
  font-size: 11.5px;
  padding: 2px 7px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
}

.author-orcid {
  font-style: normal;
  color: var(--color-success);
  margin-left: 3px;
  font-size: 10px;
}

.paper-inst {
  font-size: 11.5px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.paper-note {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  background: #f8fafc;
  border-left: 3px solid var(--color-other);
  padding: 7px 10px;
  border-radius: 0 4px 4px 0;
}

.abstract-text {
  font-size: 12px;
  line-height: 1.75;
  color: var(--color-text);
  text-align: justify;
}

/* ===== 路径概览 ===== */
.stat-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 10.5px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.path-block {
  margin-bottom: 14px;
}

.path-block-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.path-block-sub {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--color-text-secondary);
}

.path-list {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* 主轴用序号（顺序不能乱），分支用圆点 */
ol.path-list { counter-reset: step; }

.path-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 5px 8px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.path-list li:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

ol.path-list li::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 50%;
  background: var(--color-spine);
  color: #fff;
}

.path-name { flex: 1; min-width: 0; }

/* ===== 通用小标签行 ===== */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip i {
  font-style: normal;
  font-size: 10px;
  color: var(--color-text-secondary);
}

.chip-node { cursor: pointer; transition: all 0.15s; }

.chip-node:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.chip-frontier {
  background: var(--color-frontier-bg);
  border-color: #f0abfc;
}

.chip-topic { background: #f0fdf4; border-color: #bbf7d0; }

.layer-count {
  font-style: normal;
  font-size: 10px;
  color: var(--color-text-secondary);
  margin-left: 4px;
}

/* ===== 判据就绪度（改成竖排：判据文字较长）===== */
.readiness-item {
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
}

.readiness-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.readiness-evidence {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--color-text);
  margin-bottom: 4px;
}

.readiness-detail {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 5px;
}

/* ===== 节点详情：角色标签与匹配诊断 ===== */
.tag-role { background: var(--color-seed-bg); color: #1e40af; }

.diag {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.diag-row {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.6;
}

.diag-k {
  flex-shrink: 0;
  width: 68px;
  color: var(--color-text-secondary);
}

.diag-v { flex: 1; min-width: 0; color: var(--color-text); }

.diag-hit {
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  color: #be185d;
  word-break: break-all;
}

/* 不在当前图里的前置节点：标灰，避免误以为漏画 */
.prereq-out {
  opacity: 0.55;
  border-style: dashed;
}

.edge-tag {
  font-style: normal;
  font-size: 10px;
  padding: 0 4px;
  border-radius: 3px;
}

.edge-hard { background: #e2e8f0; color: #475569; }
.edge-soft { background: #f1f5f9; color: var(--color-text-secondary); }

/* ===== 相关文献 ===== */
.lit-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lit-hint {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-left: auto;
}

.lit-disclaimer {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  background: #f8fafc;
  border-left: 3px solid var(--color-other);
  padding: 8px 10px;
  border-radius: 0 4px 4px 0;
}

.count-pill {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  font-size: 10.5px;
  line-height: 17px;
  text-align: center;
  border-radius: 9px;
  background: #f1f5f9;
  color: var(--color-text-secondary);
  font-weight: 700;
  vertical-align: middle;
}

.profile-card {
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.profile-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.profile-name { font-size: 13px; font-weight: 700; }

.profile-pos {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--color-primary-light);
  color: #1e40af;
}

.profile-stats {
  font-size: 11.5px;
  color: var(--color-text);
  margin-bottom: 4px;
}

.profile-inst {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.lit-card {
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: all 0.15s;
}

.lit-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow);
}

.lit-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 5px;
}

.lit-title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-primary);
  text-decoration: none;
}

.lit-title:hover { text-decoration: underline; }

.lit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.lit-meta a { color: var(--color-success); text-decoration: none; }
.lit-meta a:hover { text-decoration: underline; }

.lit-authors {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.lit-desc {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--color-text);
  margin-bottom: 6px;
}

.lit-reason {
  font-size: 11px;
  line-height: 1.6;
  color: #92400e;
  background: #fffbeb;
  padding: 5px 8px;
  border-radius: 4px;
}

/* ===== 导出弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  width: min(860px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.modal-head h2 { font-size: 14px; font-weight: 700; }

.modal-text {
  flex: 1;
  min-height: 320px;
  margin: 12px 16px;
  padding: 10px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #f8fafc;
  resize: vertical;
}

.modal-text:focus {
  outline: none;
  border-color: var(--color-primary);
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--color-border);
}

.modal-hint {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-right: auto;
}

.copied-hint {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-success);
}

/* ===== 新组件的窄屏适配 ===== */
@media (max-width: 900px) {
  .paper-select { max-width: 180px; }
  .detail-panel { width: 100%; min-width: unset; }
  .tabs { position: static; }
  .import-panel, .alert { margin: 0 12px 10px; }
  .import-row { flex-direction: column; }
  .modal-mask { padding: 8px; }
  .stat-row { flex-wrap: wrap; }
  .stat { min-width: 70px; }
}
