/* ==================================================================
 * 挖矿软件管理 — 右侧贴边快速跳转图标条
 *
 * 范围：仅 /mining-software/（归档与 ms_* 分类归档）和软件详情页。
 * 形态：
 *   桌面（>=1450px）默认展开：右缘常驻一列图标，悬停浮出名称气泡，点击跳转。
 *   窄屏（<1450px）默认收起：右缘只留一个窄把手，点击展开 / 再点收起。
 * 无 JS 时：面板保持展开（渐进增强，不会出现「打不开」的死状态）；
 *          名称气泡由 JS 驱动，无 JS 时靠链接自身可访问名兜底。
 *
 * 布局要点：本容器 height:100% + align-items:center 实现垂直居中，
 * 刻意不使用 transform —— 这样内部的 position:fixed 气泡以视口为参照，
 * rail.js 可以直接用 getBoundingClientRect() 的坐标定位，不需要换算。
 * ================================================================== */

.msm-rail {
	position: fixed;
	right: 0;
	top: 0;
	height: 100%;
	width: auto;
	z-index: 9000;
	display: flex;
	align-items: center;
	/* 容器本身不挡点击，只有把手与面板可点 */
	pointer-events: none;
}
.msm-rail,
.msm-rail * { box-sizing: border-box; }

/* 屏幕阅读器专用文本（不依赖主题是否提供） */
.msm-rail .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------- 把手 ---------------- */
.msm-rail-toggle {
	order: 2;
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 74px;
	padding: 0;
	border: 1px solid #e2e8f0;
	border-right: 0;
	border-radius: 12px 0 0 12px;
	background: #fff;
	color: #475569;
	cursor: pointer;
	box-shadow: -4px 0 16px rgba(15, 23, 42, 0.10);
	transition: background 0.16s ease, color 0.16s ease;
}
.msm-rail-toggle:hover {
	background: #eff6ff;
	color: #1d4ed8;
}
.msm-rail-toggle-svg {
	transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
	transform: rotate(180deg); /* 收起态：箭头指向左侧，提示「拉出」 */
}
.msm-rail:not(.is-collapsed) .msm-rail-toggle-svg {
	transform: rotate(0deg); /* 展开态：箭头指向右侧，提示「收起」 */
}

/* ---------------- 面板 ---------------- */
.msm-rail-panel {
	order: 1;
	pointer-events: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 7px;
	padding: 9px 8px 8px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-right: 0;
	border-radius: 14px 0 0 14px;
	box-shadow: -8px 0 26px rgba(15, 23, 42, 0.13);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	animation: msm-rail-slide 0.22s ease both;
}
.msm-rail.is-collapsed .msm-rail-panel { display: none; }

@keyframes msm-rail-slide {
	from { opacity: 0; transform: translateX(14px); }
	to   { opacity: 1; transform: translateX(0); }
}

.msm-rail-cap {
	margin: 0;
	font-size: 10.5px;
	line-height: 1.3;
	color: #94a3b8;
	text-align: center;
	white-space: nowrap;
	letter-spacing: 0.02em;
}
.msm-rail-count {
	color: #475569;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.msm-rail-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin: 0;
	padding: 0;
}

/* ---------------- 图标项 ---------------- */
.msm-rail-item {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: 1px solid #e2e8f0;
	border-radius: 9px;
	background: #f8fafc;
	text-decoration: none;
	transition: transform 0.16s ease, border-color 0.16s ease,
		background 0.16s ease, box-shadow 0.16s ease;
}
.msm-rail-item:hover,
.msm-rail-item:focus-visible {
	background: #fff;
	border-color: #93c5fd;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.20);
	transform: translateX(-3px);
	outline: none;
}
.msm-rail-item.is-current {
	background: #eff6ff;
	border-color: #2563eb;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.msm-rail-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 7px;
	overflow: hidden;
}
.msm-rail-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.msm-rail-initial {
	font-size: 14px;
	font-weight: 800;
	color: #2563eb;
	line-height: 1;
	text-transform: uppercase;
}

/* 链接可访问名：视觉隐藏，可见名称由 rail.js 的独立气泡层显示 */
.msm-rail .msm-rail-name {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------- 名称气泡（独立层，不被面板 overflow 裁剪） ---------------- */
.msm-rail-tip {
	position: fixed;
	z-index: 9001;
	top: 0;
	left: 0;
	max-width: 240px;
	padding: 6px 10px;
	border-radius: 8px;
	background: #0f172a;
	color: #fff;
	font-size: 12.5px;
	line-height: 1.2;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transform: translateY(-50%) scale(0.96);
	transform-origin: right center;
	transition: opacity 0.14s ease, transform 0.14s ease;
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
}
.msm-rail-tip.is-on {
	opacity: 1;
	transform: translateY(-50%) scale(1);
}
.msm-rail-tip::after {
	content: "";
	position: absolute;
	left: 100%;
	top: 50%;
	margin-top: -5px;
	border: 5px solid transparent;
	border-left-color: #0f172a;
}

/* ---------------- 「全部」入口 ---------------- */
.msm-rail-all {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 24px;
	border-radius: 8px;
	background: #0f172a;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.16s ease;
}
.msm-rail-all:hover { background: #1d4ed8; color: #fff; }

/* ---------------- 窄屏微调 ---------------- */
@media (max-width: 1449px) {
	.msm-rail-toggle { width: 24px; height: 68px; }
	.msm-rail-item { width: 32px; height: 32px; }
	.msm-rail-all { width: 32px; }
}

@media (max-width: 600px) {
	.msm-rail-panel { padding: 8px 7px 7px; }
	.msm-rail-toggle { width: 22px; height: 60px; }
}
