/* ==========================================================================
   悬浮滚动工具条：返回顶部 / 到达底部
   独立实现，不依赖 jQuery，与旧主题的 .backtop 无冲突
   ========================================================================== */

.jm-scroll-tools {
	position: fixed;
	/* 右侧旧主题有 .main-im 悬浮(QQ咨询/二维码, right ~1320-1430),
	   工具条往左让 60px 避免视觉拥挤 */
	right: 84px;
	bottom: 28px;
	z-index: 90;
	display: flex;
	flex-direction: column;
	gap: 10px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity .25s ease, transform .25s ease, visibility .25s;
}

.jm-scroll-tools.jm-show {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.jm-scroll-btn {
	position: relative;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	background: rgba(255, 255, 255, .92);
	backdrop-filter: saturate(180%) blur(8px);
	-webkit-backdrop-filter: saturate(180%) blur(8px);
	color: #334155;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
	transition: border-color .18s, color .18s, background .18s, transform .18s, box-shadow .18s;
}

.jm-scroll-btn:hover {
	color: #2563eb;
	border-color: #bfdbfe;
	background: #fff;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px -4px rgba(37, 99, 235, .22);
}

.jm-scroll-btn:active {
	transform: translateY(0);
}

.jm-scroll-btn svg {
	width: 18px;
	height: 18px;
	pointer-events: none;
}

/* 返回顶部按钮：外圈进度环(用 conic-gradient 做进度条) */
.jm-scroll-top {
	overflow: hidden;
}

.jm-scroll-top::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	/* --jm-pct 由 JS 写入 0~100; 从正上方顺时针填充 */
	background: conic-gradient(from 180deg at 50% 50%,
		#2563eb calc(var(--jm-pct, 0) * 1%), transparent 0);
	opacity: .1;
	pointer-events: none;
}

/* 箭头往上收一点, 给百分比数字腾出下方空间 */
.jm-scroll-top > svg {
	transform: translateY(-4px);
}

/* 按钮下方的百分比数字 */
.jm-scroll-pct {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 4px;
	text-align: center;
	font-size: 8.5px;
	line-height: 1;
	font-weight: 700;
	letter-spacing: -.2px;
	color: #2563eb;
	font-variant-numeric: tabular-nums;
	pointer-events: none;
}

/* 已到底时高亮底部按钮 */
.jm-scroll-tools.jm-at-bottom .jm-scroll-btn.jm-scroll-bottom {
	color: #2563eb;
	border-color: #bfdbfe;
	background: #eff6ff;
}

/* 提示气泡 */
.jm-scroll-btn .jm-tip {
	position: absolute;
	right: calc(100% + 10px);
	top: 50%;
	transform: translateY(-50%) translateX(4px);
	padding: 5px 10px;
	border-radius: 7px;
	background: rgba(15, 23, 42, .9);
	color: #fff;
	font-size: 12px;
	line-height: 1.4;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s, transform .18s;
}

.jm-scroll-btn:hover .jm-tip {
	opacity: 1;
	transform: translateY(-50%) translateX(0);
}

/* ---------- 响应式 ---------- */
@media screen and (max-width: 1100px) {
	/* 平板宽度下右侧空间有限, 工具条贴边(此时与 .main-im 的横向间距仍够) */
	.jm-scroll-tools {
		right: 16px;
	}
}

@media screen and (max-width: 860px) {
	.jm-scroll-tools {
		right: 14px;
		bottom: 18px;
		gap: 8px;
	}

	/* 窄屏右侧空间有限, 靠右贴边 */

	.jm-scroll-btn {
		width: 40px;
		height: 40px;
		border-radius: 10px;
	}

	.jm-scroll-btn svg {
		width: 16px;
		height: 16px;
	}

	.jm-scroll-btn .jm-tip {
		display: none;
	}
}

@media screen and (max-width: 560px) {
	.jm-scroll-tools {
		right: 12px;
		bottom: 14px;
	}
}
