:root {
	--primary-color: #0078d4;
	--primary-light: #e8f1fb;
	--primary-lighter: #f6faff;
	--secondary-color: #0052a5;
	--accent-color: #4aa3ff;
	--text-primary: #1a1a2e;
	--text-secondary: #5a6373;
	--text-tertiary: #9aa3b2;
	--border-color: #e8edf3;
	--bg-color: #ffffff;
	--bg-soft: #f7f9fc;
	--shadow-sm: 0 1px 3px rgba(0, 60, 130, 0.04);
	--shadow-md: 0 4px 16px rgba(0, 60, 130, 0.06);
	--shadow-lg: 0 8px 24px rgba(0, 60, 130, 0.08);
	--radius-sm: 8px;
	--radius-md: 12px;
	--radius-lg: 16px;
	--transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
}

body {
	background-color: var(--bg-color);
	font-family: -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', 'PingFang SC', 'Segoe UI', Arial, sans-serif;
	color: var(--text-primary);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* ============ 顶部头部 ============ */
/* 头部容器：与下方主体一致的居中定宽外框 */
.header {
	max-width: 1400px;
	margin: 0 auto;
	padding: 24px 24px 0;
	position: relative;
}

/* 头部卡片：白底渐变 + 边框/圆角/阴影，与 search-box、category-nav 风格统一 */
.header-inner {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-sm);
	background: linear-gradient(135deg, #ffffff 0%, #f6faff 100%);
	padding: 20px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	transition: var(--transition);
}

.header-inner:hover {
	box-shadow: var(--shadow-md);
}

/* 装饰光晕：置于卡片背景之上、内容之下 */
.header-inner::before {
	content: '';
	position: absolute;
	top: -50%;
	right: -10%;
	width: 400px;
	height: 400px;
	background: radial-gradient(circle, rgba(0, 120, 212, 0.06) 0%, transparent 70%);
	border-radius: 50%;
	pointer-events: none;
	z-index: -1;
}

.header-title {
	display: flex;
	align-items: center;
	gap: 14px;
	cursor: pointer;
	transition: var(--transition);
}

.header-title:hover .header-logo {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0, 120, 212, 0.35);
}

.header-title:hover h1 {
	color: var(--primary-color);
}

.header-logo {
	width: 44px;
	height: 44px;
	border-radius: var(--radius-sm);
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 20px;
	box-shadow: 0 4px 12px rgba(0, 120, 212, 0.25);
	transition: var(--transition);
}

.header h1 {
	font-size: 22px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 0;
	letter-spacing: 0.5px;
	transition: var(--transition);
}

.header-subtitle {
	font-size: 13px;
	color: var(--text-tertiary);
	margin-top: 2px;
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

.header-tag {
	padding: 6px 14px;
	background: var(--primary-light);
	color: var(--primary-color);
	border-radius: 20px;
	font-size: 12px;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 6px;
}

.header-tag i {
	font-size: 11px;
}

/* ============ 容器 ============ */
.container {
	max-width: 1400px;
	margin: 0 auto;
	padding: 24px;
}

/* ============ 搜索框 ============ */
.search-section {
	margin-bottom: 24px;
}

.search-box {
	background: white;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 8px;
	display: flex;
	align-items: center;
	gap: 8px;
	transition: var(--transition);
	box-shadow: var(--shadow-sm);
}

.search-box:focus-within {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 4px rgba(0, 120, 212, 0.08), var(--shadow-md);
}

.search-icon-wrapper {
	padding: 0 16px;
	color: var(--text-tertiary);
	font-size: 16px;
}

.search-box .layui-input {
	border: none !important;
	height: 44px;
	line-height: 44px;
	border-radius: 0;
	padding: 0;
	font-size: 15px;
	background: transparent;
	flex: 1;
	box-shadow: none !important;
}

.search-box .layui-input:focus {
	border: none !important;
	box-shadow: none !important;
}

.search-btn {
	height: 44px;
	line-height: 44px;
	padding: 0 28px;
	border: none;
	border-radius: var(--radius-sm);
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	color: white;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: var(--transition);
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.search-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 120, 212, 0.3);
}

.search-btn:active {
	transform: translateY(0);
}

/* ============ 分类导航 ============ */
.category-nav {
	background: white;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	margin-bottom: 24px;
	overflow: hidden;
	box-shadow: var(--shadow-sm);
	transition: var(--transition);
}

.category-nav:hover {
	box-shadow: var(--shadow-md);
}

/* ============ 分类导航折叠/展开（预览模式）============ */
/* 折叠时保留选项卡标题 + 内容前两行，其余渐隐，节约页面高度 */
.category-nav.collapsed .nav-content.active {
	max-height: 150px;
}

/* 底部渐变遮罩，暗示下方还有更多按钮 */
.category-nav.collapsed .nav-content.active::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 48px;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff 88%);
	pointer-events: none;
	z-index: 2;
}

/* 展开/收起按钮（始终显示于导航底部，双向切换） */
/* 无背景、无分隔线，与标签内容区域融为一体 */
.nav-expand-btn {
	display: flex;
	width: 100%;
	padding: 10px 24px 16px;
	background: transparent;
	border: none;
	color: var(--primary-color);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: var(--transition);
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-family: inherit;
}

.nav-expand-btn:hover {
	color: var(--secondary-color);
}

.nav-expand-btn:hover .expand-text {
	text-decoration: underline;
}

/* 箭头旋转动画：带回弹缓动，展开时翻转朝上 */
.nav-expand-btn .expand-arrow {
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-nav:not(.collapsed) .nav-expand-btn .expand-arrow {
	transform: rotate(180deg);
}

.category-nav:not(.collapsed) .nav-expand-btn:hover .expand-arrow {
	transform: rotate(180deg);
}

.nav-tabs {
	display: flex;
	border-bottom: 1px solid var(--border-color);
	background: var(--bg-soft);
	overflow-x: auto;
	scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
	display: none;
}

.nav-tab {
	padding: 14px 24px;
	font-size: 14px;
	font-weight: 500;
	color: var(--text-secondary);
	cursor: pointer;
	transition: var(--transition);
	border: none;
	background: transparent;
	white-space: nowrap;
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
}

.nav-tab:hover {
	color: var(--primary-color);
	background: rgba(0, 120, 212, 0.03);
}

.nav-tab.active {
	color: var(--primary-color);
	background: white;
}

.nav-tab.active::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
	border-radius: 3px 3px 0 0;
}

.nav-tab i {
	font-size: 14px;
}

.nav-content {
	display: none;
	padding: 20px 24px;
	overflow: hidden;
	position: relative;
	max-height: 2000px;
	transition: max-height 0.35s ease;
}

.nav-content.active {
	display: block;
	animation: fadeIn 0.3s ease-out;
}

.nav-links {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
}

.nav-link {
	padding: 10px 14px;
	border-radius: var(--radius-sm);
	background: var(--primary-lighter);
	font-size: 14px;
	color: var(--text-primary);
	cursor: pointer;
	transition: var(--transition);
	border: 1px solid transparent;
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: flex-start;
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nav-link:hover {
	background: var(--primary-light);
	color: var(--primary-color);
	border-color: rgba(0, 120, 212, 0.2);
	box-shadow: var(--shadow-sm);
}

.nav-link i {
	color: var(--primary-color);
	font-size: 13px;
	flex-shrink: 0;
}

.nav-link span,
.nav-link {
	overflow: hidden;
	text-overflow: ellipsis;
}

.section-title {
	grid-column: 1 / -1;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-tertiary);
	text-transform: uppercase;
	letter-spacing: 1px;
	padding: 8px 0 4px;
	margin-top: 8px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.section-title:first-child {
	margin-top: 0;
}

.section-title i {
	color: var(--primary-color);
}

/* ============ 主体布局 ============ */
.map-container {
	display: flex;
	gap: 20px;
	/* stretch 让左侧栏目导航与右侧栏目详情外框高度保持一致 */
	align-items: stretch;
}

.tree-box {
	flex: 0 0 auto;
	min-width: 280px;
	width: max-content;
	max-width: 500px;
	background: white;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-sm);
	padding: 20px;
	transition: var(--transition);
	position: sticky;
	top: 20px;
	max-height: calc(100vh - 40px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.tree-box:hover {
	box-shadow: var(--shadow-md);
}

.tree-box.collapsed {
	display: none;
}

.content-box {
	flex: 1;
	min-width: 0;
	background: white;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-sm);
	padding: 24px;
	transition: var(--transition);
	min-height: 500px;
}

.content-box:hover {
	box-shadow: var(--shadow-md);
}

.content-box.expanded {
	flex: 1 1 100%;
}

/* ============ 树形导航 ============ */
.tree-title {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--border-color);
	color: var(--text-primary);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.tree-title-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tree-title i {
	color: var(--primary-color);
}

.toggle-btn {
	background: var(--primary-lighter);
	border: none;
	color: var(--primary-color);
	cursor: pointer;
	font-size: 13px;
	padding: 6px 10px;
	border-radius: var(--radius-sm);
	transition: var(--transition);
}

.toggle-btn:hover {
	background: var(--primary-light);
}

.restore-btn {
	background: #ffffff;
	color: var(--primary-color);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 8px 14px;
	cursor: pointer;
	display: none;
	z-index: 10;
	transition: var(--transition);
	font-size: 13px;
	align-items: center;
	gap: 6px;
	margin-bottom: 16px;
}

.restore-btn:hover {
	background: var(--primary-light);
	border-color: var(--primary-color);
}

.restore-btn i {
	margin-right: 5px;
}

.content-box.expanded .restore-btn {
	display: inline-flex;
}

.tree-scroll {
	overflow-y: auto;
	overflow-x: hidden;
	flex: 1;
	padding-right: 4px;
	padding-bottom: 4px;
}

.tree-scroll::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

.tree-scroll::-webkit-scrollbar-track {
	background: transparent;
}

.tree-scroll::-webkit-scrollbar-thumb {
	background: var(--border-color);
	border-radius: 3px;
}

.tree-scroll::-webkit-scrollbar-thumb:hover {
	background: var(--text-tertiary);
}

.layui-tree {
	padding-left: 0;
}

.layui-tree li {
	margin: 2px 0;
}

.layui-tree li i {
	color: var(--primary-color);
	transition: var(--transition);
}

.layui-tree .layui-tree-entry {
	padding: 10px;
	border-radius: var(--radius-sm);
	transition: var(--transition);
	overflow: hidden;
	min-height: 40px;
	line-height: 1.8;
}

.layui-tree .layui-tree-txt {
	padding: 0;
	font-size: 14px;
	line-height: 1.8;
	color: var(--text-primary);
	transition: var(--transition);
	display: inline-block;
}

.layui-tree .layui-tree-checked > .layui-tree-txt {
	color: var(--primary-color);
	font-weight: 600;
	background: var(--primary-lighter);
	padding: 4px 10px;
	border-radius: var(--radius-sm);
}

.layui-tree-icon .layui-icon {
	font-size: 10px;
}

.layui-tree-icon {
	line-height: 1;
}

/* 首页节点显示home图标替代默认的折叠/展开图标 */
.layui-tree-set[data-id="0"] > .layui-tree-entry .layui-tree-icon i.layui-icon {
	display: none;
}
.layui-tree-set[data-id="0"] > .layui-tree-entry .layui-tree-icon {
	position: relative;
	width: 16px;
	height: 16px;
	line-height: 16px;
	text-align: center;
	border: 0;
}
.layui-tree-set[data-id="0"] > .layui-tree-entry .layui-tree-icon::before {
	content: "\f015";
	font-family: "Font Awesome 5 Pro";
	font-weight: 900;
	font-size: 13px;
	color: var(--primary-color);
	font-style: normal;
}
.layui-tree-set[data-id="0"]:before,
.layui-tree-set[data-id="0"]:after {
	display: none;
}
.layui-tree-set[data-id="0"] > .layui-tree-pack:before {
	display: none;
}

/* ============ 内容区 ============ */
.category-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 20px;
	padding-left: 10px;
	color: var(--text-primary);
	display: flex;
	align-items: center;
	gap: 10px;
}

.category-title i {
	color: var(--primary-color);
}

.badge {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	font-size: 12px;
	font-weight: 600;
	color: var(--primary-color);
	background: var(--primary-lighter);
	border-radius: 12px;
	margin-left: 4px;
}

/* ============ 链接卡片 ============ */
.link-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.link-item {
	background: white;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	transition: var(--transition);
	position: relative;
	overflow: hidden;
}

.link-item:hover {
	background: var(--primary-lighter);
	border-color: rgba(0, 120, 212, 0.25);
	box-shadow: 0 2px 8px rgba(0, 120, 212, 0.08);
}

/* 整张卡片作为链接，padding 移至 <a> 上使全卡片可点击 */
.link-item .link-item-link {
	display: block;
	padding: 16px 18px;
	text-decoration: none;
	color: inherit;
	transition: var(--transition);
}

.link-item .link-item-title {
	color: var(--text-primary);
	font-size: 15px;
	font-weight: 600;
	display: flex;
	align-items: center;
	margin-bottom: 6px;
	transition: var(--transition);
}

.link-item:hover .link-item-title {
	color: var(--primary-color);
}

.link-item .link-item-title i {
	margin-right: 5px;
	color: var(--primary-color);
	width: 18px;
	text-align: center;
	font-size: 14px;
	transition: var(--transition);
	flex-shrink: 0;
}

.link-item .link-item-title i.fa-folder {
	color: var(--accent-color);
}

.link-item .link-item-title i.fa-file-alt {
	color: var(--text-tertiary);
}

.link-item:hover .link-item-title i.fa-file-alt {
	color: var(--primary-color);
}

/* 语义搜索结果中的相似度得分 */
.link-item .link-score {
	margin: -24px -5px 0 auto;
	font-size: 11px;
	opacity: 0.7;
	font-weight: normal;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 4px;
}
.link-item .link-score i{
	margin-right: 0;
}

/* 末级栏目卡片：右侧淡淡的弧形渐变底色，与有子目录的栏目卡片区分 */
.link-item.link-item-leaf::before {
	content: '';
	position: absolute;
	right: -50px;
	top: 50%;
	transform: translateY(-50%);
	width: 180px;
	height: 180px;
	background: radial-gradient(circle, rgba(0, 120, 212, 0.05) 0%, rgba(0, 120, 212, 0.025) 45%, transparent 72%);
	border-radius: 50%;
	pointer-events: none;
	z-index: 0;
	transition: var(--transition);
}

.link-item.link-item-leaf:hover::before {
	background: radial-gradient(circle, rgba(0, 120, 212, 0.09) 0%, rgba(0, 120, 212, 0.04) 45%, transparent 72%);
}

/* 右侧淡淡的图标背景水印，叠加在弧形渐变之上 */
.link-item.link-item-leaf::after {
	content: '\f15c';
	font-family: 'Font Awesome 5 Pro';
	font-weight: 900;
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 52px;
	color: rgba(0, 120, 212, 0.06);
	pointer-events: none;
	z-index: 0;
	line-height: 1;
	transition: var(--transition);
}

.link-item.link-item-leaf:hover::after {
	color: rgba(0, 120, 212, 0.12);
}

/* 确保卡片内容在水印图标之上 */
.link-item.link-item-leaf .link-item-link {
	position: relative;
	z-index: 1;
}

.link-path {
	display: block;
	color: var(--text-tertiary);
	font-size: 12px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--bg-soft);
	line-height: 1.5;
	transition: var(--transition);
}

.link-item:hover .link-path {
	border-top-color: rgba(0, 120, 212, 0.1);
}

/* ============ 欢迎页 ============ */
.welcome-message {
	position: relative;
	overflow: hidden;
	text-align: center;
	padding: 130px 24px;
	border-radius: var(--radius-md);
}

/* 渐变波纹：从图标位置向外缓缓扩散的同心圆环 */
.welcome-message::before,
.welcome-message::after {
	content: '';
	position: absolute;
	top: 220px;
	left: 50%;
	width: 140px;
	height: 140px;
	margin: -70px 0 0 -70px;
	border-radius: 50%;
	border: 1px solid rgba(0, 120, 212, 0.14);
	pointer-events: none;
	z-index: 0;
	animation: welcome-ripple 5s ease-out infinite;
}

.welcome-message::after {
	animation-delay: 2.5s;
}

@keyframes welcome-ripple {
	0% {
		transform: scale(0.5);
		opacity: 0;
	}
	25% {
		opacity: 0.8;
	}
	100% {
		transform: scale(3.2);
		opacity: 0;
	}
}

/* 内容置于波纹之上 */
.welcome-message > *:not(.welcome-graph) {
	position: relative;
	z-index: 1;
}

/* 栏目关系图 Canvas 背景 */
.welcome-graph {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 0;
}

.welcome-icon {
	width: 80px;
	height: 80px;
	margin: 50px auto 24px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 32px;
	box-shadow: 0 8px 24px rgba(0, 120, 212, 0.2);
}

.welcome-message h2 {
	font-size: 24px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 0 0 16px;
}

.welcome-message p {
	color: var(--text-secondary);
	font-size: 14px;
	margin: 0 auto 12px;
	max-width: 500px;
	line-height: 1.8;
}

.welcome-features {
	display: flex;
	justify-content: center;
	gap: 32px;
	margin-top: 32px;
	flex-wrap: wrap;
}

.welcome-feature {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.welcome-feature-icon {
	width: 48px;
	height: 48px;
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--primary-color);
	font-size: 18px;
	box-shadow: var(--shadow-sm);
	background:
		radial-gradient(circle at 50% 150px, rgba(0, 120, 212, 0.74) 0%, transparent 55%),
		linear-gradient(135deg, var(--primary-lighter) 0%, #ffffff 45%, var(--primary-lighter) 100%);
}

.welcome-feature-text {
	font-size: 12px;
	color: var(--text-secondary);
}

/* ============ 无结果 ============ */
.no-result {
	text-align: center;
	padding: 60px 20px;
}

.no-result i {
	font-size: 56px;
	margin-bottom: 16px;
	color: var(--border-color);
}

.no-result p {
	font-size: 15px;
	color: var(--text-tertiary);
	margin: 8px 0 0;
}

/* ============ 位置导航 ============ */
.nav-path {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 16px;
	padding: 12px 16px;
	background: var(--bg-soft);
	border-radius: var(--radius-sm);
	font-size: 13px;
	gap: 4px;
}

.nav-path a {
	color: var(--primary-color);
	text-decoration: none;
	padding: 3px 8px;
	border-radius: 4px;
	transition: var(--transition);
}

.path-links a:first-child {
	padding-left:0;
}

.nav-path a:hover {
	background: var(--primary-lighter);
}

.nav-path .separator {
	color: var(--text-tertiary);
	margin: 0 2px;
}

.nav-path .current {
	color: var(--text-primary);
	font-weight: 500;
	padding-left: 8px;
}

.back-btn {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	margin-right: 8px;
	background: white;
	color: var(--text-primary);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	text-decoration: none;
	transition: var(--transition);
	font-size: 13px;
	gap: 6px;
}

.back-btn:hover {
	background: var(--primary-lighter);
	border-color: var(--primary-color);
	color: var(--primary-color);
}

/* ============ 二次搜索工具栏 ============ */
.result-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 20px;
	padding: 14px;
	background: var(--bg-soft);
	border-radius: var(--radius-md);
	border: 1px solid var(--border-color);
}

.result-toolbar .toolbar-input {
	flex: 1;
	min-width: 200px;
	position: relative;
	z-index: 10;
}

.result-toolbar .layui-input {
	height: 40px;
	line-height: 40px;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 0 14px;
	background: white;
	transition: var(--transition);
}

.result-toolbar .layui-input:focus {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.08);
}

.result-toolbar .toolbar-actions {
	display: flex;
	gap: 8px;
}

.result-toolbar .toolbar-actions button {
	white-space: nowrap;
}

.result-toolbar .layui-btn {
	height: 40px;
	line-height: 40px;
	padding: 0 18px;
	border-radius: var(--radius-sm);
	font-size: 13px;
	border: none;
}

.result-toolbar .layui-btn-normal {
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.result-toolbar .layui-btn-primary {
	background: white;
	border: 1px solid var(--border-color);
	color: var(--text-secondary);
}

.result-toolbar .layui-btn-primary:hover {
	border-color: var(--primary-color);
	color: var(--primary-color);
}

.result-toolbar .toolbar-meta {
	width: 100%;
	font-size: 12px;
	color: var(--text-tertiary);
	display: flex;
	align-items: center;
	gap: 6px;
}

.result-toolbar .toolbar-meta i {
	color: var(--primary-color);
}

/* ============ 动画 ============ */
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.fade-in {
	animation: fadeIn 0.4s ease-out forwards;
}

.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }

/* ============ LayUI 树形线条 ============ */
.layui-tree-line .layui-tree-set:before { left: 0; }
.layui-tree-line .layui-tree-set .layui-tree-set:last-child:before { height: calc(50% + 5px); }
.layui-tree-line .layui-tree-set .layui-tree-set:after { top: 24px; left: 0; }

/* ============ 响应式：平板 ============ */
@media (max-width: 992px) {
	.link-list {
		grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	}

	.tree-box {
		min-width: 240px;
		max-width: 350px;
	}
}

/* ============ 响应式：手机 ============ */
@media (max-width: 768px) {
	.container {
		padding: 16px;
	}

	.header {
		padding: 16px 16px 0;
	}

	.header-inner {
		padding: 16px;
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.header-logo {
		width: 38px;
		height: 38px;
		font-size: 17px;
	}

	.header h1 {
		font-size: 18px;
	}

	.header-subtitle {
		font-size: 12px;
	}

	.header-actions {
		width: 100%;
		justify-content: flex-start;
	}

	.map-container {
		flex-direction: column;
		gap: 16px;
	}

	.tree-box {
		flex: 1 1 100%;
		min-width: 100%;
		width: auto;
		max-width: 100%;
		position: relative;
		top: 0;
		max-height: 400px;
	}

	/* 手机端树形导航限制宽度100%，内容横向可拖动 */
	.tree-scroll {
		overflow-x: auto;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.tree-scroll .layui-tree {
		min-width: max-content;
	}

	.content-box {
		flex: 1 1 100%;
		min-width: 100%;
		padding: 16px;
	}

	.welcome-message {
		padding: 120px 16px;
	}

	/* 手机端图标位置更高，波纹圆心同步上移 */
	.welcome-message::before,
	.welcome-message::after {
		top: 200px;
	}

	.welcome-message h2 {
		font-size: 20px;
	}

	.welcome-features {
		gap: 20px;
	}

	.search-box {
		flex-wrap: wrap;
	}

	.search-icon-wrapper {
		display: none;
	}

	.search-box .layui-input {
		width: 100%;
		order: 1;
	}

	.search-btn {
		width: 100%;
		justify-content: center;
		order: 2;
	}

	.category-title {
		font-size: 16px;
	}

	.nav-tab {
		padding: 12px 16px;
		font-size: 13px;
	}

	.nav-content {
		padding: 16px;
	}

	/* 手机端分类按钮：2列整齐排列 */
	.nav-links {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	.nav-link {
		padding: 8px 12px;
		font-size: 13px;
	}

	.result-toolbar {
		flex-direction: column;
		gap: 8px;
	}

	.result-toolbar .toolbar-input {
		width: 100%;
		min-width: auto;
	}

	.result-toolbar .toolbar-actions {
		width: 100%;
	}

	.result-toolbar .toolbar-actions .layui-btn {
		flex: 1;
	}

	.link-list {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.nav-path {
		font-size: 12px;
		padding: 10px 12px;
	}

	.back-btn {
		padding: 4px 10px;
		font-size: 12px;
	}
}

/* ============ 响应式：小手机 ============ */
@media (max-width: 480px) {
	.container {
		padding: 12px;
	}

	.header {
		padding: 12px 12px 0;
	}

	.header h1 {
		font-size: 16px;
	}

	.welcome-icon {
		width: 64px;
		height: 64px;
		font-size: 26px;
	}

	.welcome-message h2 {
		font-size: 18px;
	}

	.welcome-features {
		gap: 16px;
	}

	.welcome-feature-icon {
		width: 40px;
		height: 40px;
		font-size: 15px;
	}

	/* 小手机端分类按钮2列排列 */
	.nav-links {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	/* 2列布局下允许文字换行、居中，避免长名称被截断 */
	.nav-link {
		font-size: 12px;
		padding: 8px 8px 8px 20px;
		white-space: normal;
		text-align: center;
		line-height: 1.3;
	}

	.nav-link i {
		font-size: 12px;
	}
}

/* ============ LayUI 表单适配 ============ */
@media screen and (max-width: 450px) {
	.layui-form-item .layui-input-inline {
		display: block;
		float: none;
		left: -3px;
		width: auto !important;
		margin: 0 0 10px 0;
	}
}

/* ============ 关系图视图切换 ============ */
.view-toggle {
	display: inline-flex;
	margin-left: auto;
	gap: 4px;
	background: var(--bg-soft);
	border-radius: var(--radius-sm);
	padding: 3px;
	border: 1px solid var(--border-color);
}

.view-btn {
	padding: 6px 12px;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	font-size: 12px;
	font-weight: 500;
	border-radius: calc(var(--radius-sm) - 2px);
	cursor: pointer;
	transition: var(--transition);
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: inherit;
}

.view-btn:hover {
	color: var(--primary-color);
	background: var(--primary-lighter);
}

.view-btn.active {
	background: var(--primary-color);
	color: white;
	box-shadow: 0 2px 6px rgba(0, 120, 212, 0.25);
}

.view-btn i {
	font-size: 11px;
}

.view-btn.active i {
	color: white;
}

.branch-graph-container {
	position: relative;
	background: white;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	overflow: hidden;
	min-height: 750px;
	height: calc(100vh - 240px);
	display: flex;
	flex-direction: column;
	box-shadow: var(--shadow-sm);
}

.branch-graph-canvas {
	flex: 1;
	position: relative;
	overflow: hidden;
	background: linear-gradient(135deg, #ffffff 0%, var(--primary-lighter) 100%);
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
}

.branch-graph-canvas canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.branch-graph-canvas:active {
	cursor: grabbing;
}

.branch-graph-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid var(--border-color);
	background: var(--bg-soft);
	flex-shrink: 0;
	flex-wrap: wrap;
	gap: 8px;
	order: -1;  /* 图例和展开按钮在顶部 */
}

.branch-graph-stats {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--text-tertiary);
}

.branch-graph-stats .stat-value {
	font-size: 15px;
	font-weight: 600;
	color: var(--primary-color);
}

.branch-graph-expand-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	background: var(--primary-lighter);
	color: var(--primary-color);
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: var(--transition);
	font-family: inherit;
	white-space: nowrap;
}

.branch-graph-expand-btn:hover {
	background: var(--primary-light);
	border-color: var(--primary-color);
}

.branch-graph-expand-btn.collapse-mode {
	background: var(--primary-light);
	border-color: var(--primary-color);
}

.branch-graph-legend {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.branch-graph-legend .legend-item {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	color: var(--text-secondary);
}

.branch-graph-legend .legend-dot {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	flex-shrink: 0;
}

.branch-graph-legend .legend-dot.root {
	background: rgba(0, 120, 212, 0.22);
	box-shadow: 0 0 10px rgba(0, 120, 212, 0.35);
	position: relative;
}

.branch-graph-legend .legend-dot.collapsed {
	background: rgba(0, 120, 212, 0.22);
	position: relative;
}

.branch-graph-legend .legend-dot.collapsed::after {
	content: '+';
	position: absolute;
	top: 45%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: white;
	font-size: 14px;
	font-weight: bold;
	line-height: 1;
}

.branch-graph-legend .legend-dot.expanded {
	background: transparent;
	border: 2px solid rgba(0, 120, 212, 0.22);
	box-sizing: border-box;
	position: relative;
}

.branch-graph-legend .legend-dot.expanded::after {
	content: '−';
	position: absolute;
	top: 45%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: rgba(0, 120, 212, 0.22);
	font-size: 16px;
	font-weight: bold;
	line-height: 1;
}

.branch-graph-legend .legend-dot.leaf {
	background: rgba(16, 185, 129, 0.25);
}

.branch-graph-tip {
	padding: 8px 16px;
	border-top: 1px solid var(--border-color);
	background: var(--bg-soft);
	display: flex;
	justify-content: center;
	gap: 18px;
	font-size: 11px;
	color: var(--text-tertiary);
	flex-shrink: 0;
	flex-wrap: wrap;
	order: 1;  /* 操作说明在底部 */
}

.branch-graph-tip span {
	display: flex;
	align-items: center;
	gap: 4px;
}

.branch-graph-tip i {
	font-size: 10px;
	color: var(--primary-color);
	opacity: 0.6;
}

#branchGraphTooltip {
	position: fixed;
	display: none;
	background: white;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-sm);
	padding: 10px 14px;
	font-size: 12px;
	color: var(--text-primary);
	z-index: 1000;
	pointer-events: none;
	max-width: 360px;
	min-width: 150px;
	box-shadow: var(--shadow-lg);
}

#branchGraphTooltip strong {
	color: var(--text-primary);
	font-size: 13px;
	display: block;
	margin-bottom: 4px;
}

#branchGraphTooltip .tip-path {
	font-size: 11px;
	color: var(--text-tertiary);
	margin: 4px 0;
	line-height: 1.4;
	word-break: break-all;
}

#branchGraphTooltip .tip-info {
	color: var(--text-tertiary);
	font-size: 11px;
}

body.is-grabbing,
body.is-grabbing * {
	user-select: none !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	cursor: grabbing !important;
}

@media (max-width: 768px) {
	.view-toggle {
		margin-left: 0;
		width: 100%;
		justify-content: center;
		flex-wrap: wrap;
	}

	.branch-graph-container {
		min-height: 500px;
	}

	.branch-graph-toolbar {
		padding: 10px 12px;
		flex-direction: column;
		align-items: stretch;
	}

	.branch-graph-legend {
		gap: 8px;
	}

	.branch-graph-tip {
		gap: 10px;
		font-size: 10px;
		padding: 6px 12px;
	}

	.category-title {
		flex-wrap: wrap;
		gap: 8px;
	}
}

/* ============ 树形图视图（复用关系图容器样式，仅微调背景区分） ============ */
.branch-tree-container .branch-graph-canvas {
	background: linear-gradient(135deg, #ffffff 0%, #fafcff 50%, var(--primary-lighter) 100%);
}

/* 三按钮切换栏：手机端缩小按钮确保一行容纳 列表/关系图/树形图 */
@media (max-width: 768px) {
	.view-btn {
		padding: 5px 9px;
		font-size: 11px;
		gap: 4px;
	}

	.view-btn i {
		font-size: 10px;
	}
}

@media (max-width: 480px) {
	.view-btn {
		padding: 5px 7px;
		font-size: 10px;
		gap: 3px;
	}

	.view-btn i {
		font-size: 9px;
	}
}
