:root {
  /* 主色调与文字颜色 */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  
  /* 圆角大小 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  /* 柔和阴影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  
  /* 现代系统字体栈 */
  --font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* --- 整体布局：居中限制最大宽度，响应式设计 --- */
.app-shell {
  display: flex;
  flex-direction: column;
  max-width: 1280px; /* 放宽整体宽度以容纳大尺寸媒体 */
  margin: 0 auto;
  padding: 20px;
  gap: 20px;
  min-height: 100vh;
}

/* PC端：双列排布 */
@media (min-width: 768px) {
  .app-shell {
    flex-direction: row;
    padding: 40px 20px;
  }
}

/* --- 侧边栏样式 --- */
.sidebar {
  width: 100%;
}

@media (min-width: 768px) {
  .sidebar {
    width: 300px;
    flex-shrink: 0;
  }
  .sidebar-card {
    /* PC 端让侧边栏吸顶，主内容很长时滚动也不会丢失侧栏 */
    position: sticky;
    top: 40px;
  }
}

.sidebar-card, .main-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.sidebar-card {
  padding: 24px;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-muted); /* 更改为不显眼的淡灰色 */
}

.sidebar-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.ghost-btn {
  flex: 1;
  background-color: #f8fafc;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ghost-btn:hover {
  background-color: var(--border-light);
}

.meta {
  background-color: #f8fafc;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
}

.meta div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.meta div:last-child {
  margin-bottom: 0;
}

.meta-label {
  color: var(--text-muted);
}

#currentNodeId, #currentNodeType {
  font-weight: 500;
}

.history-wrap {
  margin-top: 16px;
}

.history-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

#historyList {
  list-style: none;
  padding: 0;
  margin: 0;
  min-height: 320px;
  max-height: min(68vh, 560px);
  overflow-y: auto;
}

#historyList li {
  padding: 8px 0;
  font-size: 0.9rem;
  border-bottom: 1px dashed var(--border-light);
  color: var(--text-muted);
}

.history-entry {
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.55;
}

#historyList li:last-child {
  border-bottom: none;
}

/* 自定义侧栏历史记录的滚动条 (Webkit) */
#historyList::-webkit-scrollbar {
  width: 6px;
}
#historyList::-webkit-scrollbar-track {
  background: transparent;
}
#historyList::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 10px;
}

/* --- 主内容区样式 --- */
.main {
  flex: 1;
  min-width: 0; /* 防止内容撑破 flex 布局 */
}

.main-card {
  padding: 32px;
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .main-card {
    padding: 48px;
  }
}

.node-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  background-color: #dbeafe;
  color: #1e40af;
  margin-bottom: 16px;
}

.node-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--text-muted);
  line-height: 1.25;
}

.node-text {
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.7rem);
  font-weight: 400;
  color: var(--text-main);
  letter-spacing: 0.01em;
  line-height: 1.8;
  margin-bottom: 32px;
}

.node-text p {
  margin: 0;
}

.content-media-figure {
  margin: 0;
}

.content-caption {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-muted);
}

/* --- 媒体元素（图片、视频等）统一样式 --- */
.node-text img,
.node-text video,
.node-text iframe {
  max-width: 100%; /* 保证在容器内自适应，最大撑满主内容区 */
  height: auto; /* 保持原生比例不变形 */
  border-radius: var(--radius-md); /* 使用与卡片一致的圆角 */
  box-shadow: var(--shadow-sm); /* 添加微小的阴影增加层次感 */
  border: 1px solid var(--border-light); /* 与页面整体风格一致的边框 */
  margin: 0;
  display: block; /* 独立成行排布 */
}

.content-link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  word-break: break-word;
  transition: all 0.2s ease;
}

.content-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.content-download {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #0f766e;
}

.content-download:hover {
  background: #cffafe;
  border-color: #67e8f9;
  color: #115e59;
}

/* --- 选项按钮样式 --- */
.option-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  background-color: var(--bg-card);
  border: 2px solid var(--border-light);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  color: #475569; /* 颜色调淡，与边框更统一 */
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-btn:hover {
  border-color: var(--primary-color);
  background-color: #f8fafc;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  color: var(--primary-hover);
}

.option-btn:active {
  transform: translateY(0);
}
