/* ============================================================
 * YimCore 登录滑块拼图安全验证 — Apple HIG 风格
 * 仅登录页使用，类名前缀 yc-cap-，避免与站点其他样式冲突。
 * ============================================================ */

.yc-cap-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.45);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	padding: 16px;
	box-sizing: border-box;
}

.yc-cap-overlay.is-show {
	display: flex;
}

.yc-cap-card {
	position: relative;
	width: 360px;
	max-width: 92vw;
	box-sizing: border-box;
	padding: 20px;
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
	font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
		"Helvetica Neue", Arial, sans-serif;
	color: #1d1d1f;
	animation: yc-cap-pop 0.18s ease-out;
}

@keyframes yc-cap-pop {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.yc-cap-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #8e8e93;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.yc-cap-close:hover {
	background: #f2f2f7;
	color: #1d1d1f;
}

.yc-cap-title {
	font-size: 17px;
	font-weight: 600;
	letter-spacing: 0.2px;
	text-align: center;
}

.yc-cap-subtitle {
	margin-top: 4px;
	font-size: 12px;
	color: #8e8e93;
	text-align: center;
}

.yc-cap-frame {
	position: relative;
	margin-top: 16px;
	width: 100%;
	border-radius: 10px;
	overflow: hidden;
	background: #e5e5ea;
	line-height: 0;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.yc-cap-frame .yc-cap-bg {
	display: block;
	width: 100%;
	height: auto;
	user-select: none;
	-webkit-user-select: none;
	pointer-events: none;
}

.yc-cap-frame .yc-cap-piece {
	position: absolute;
	left: 0;
	top: 0;
	display: block;
	/* 宽高由 JS 按服务端返回的 size/track 设置，形状/角度已在 PNG mask 中 */
	width: auto;
	height: auto;
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
	z-index: 2;
}

.yc-cap-track {
	position: relative;
	margin-top: 16px;
	height: 44px;
	width: 100%;
	border-radius: 22px;
	background: #f2f2f7;
	border: 1px solid #e5e5ea;
	box-sizing: border-box;
	overflow: hidden;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.yc-cap-progress {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0;
	border-radius: 22px;
	background: rgba(46, 144, 250, 0.16);
	transition: width 0.06s linear, background 0.2s ease;
}

.yc-cap-track-label {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	color: #8e8e93;
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
}

.yc-cap-handle {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 3;
	width: 44px;
	height: 44px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: 1px solid #e5e5ea;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
	cursor: grab;
	touch-action: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.yc-cap-overlay.is-dragging .yc-cap-handle {
	cursor: grabbing;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.yc-cap-arrow {
	position: relative;
	width: 10px;
	height: 10px;
}

.yc-cap-arrow::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 9px;
	height: 9px;
	border-top: 2px solid #2e90fa;
	border-right: 2px solid #2e90fa;
	border-radius: 1px;
	transform: translate(-65%, -50%) rotate(45deg);
	transition: border-color 0.2s ease;
}

.yc-cap-footer {
	margin-top: 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.yc-cap-hint {
	font-size: 12px;
	line-height: 1.4;
	color: #8e8e93;
}

.yc-cap-hint.is-success {
	color: #34c759;
	font-weight: 600;
}

.yc-cap-hint.is-error {
	color: #ff3b30;
	font-weight: 600;
}

.yc-cap-refresh {
	border: 0;
	background: transparent;
	padding: 0;
	font-size: 12px;
	color: #2e90fa;
	cursor: pointer;
	white-space: nowrap;
}

.yc-cap-refresh:hover {
	text-decoration: underline;
}

/* 成功态 */
.yc-cap-overlay.is-success .yc-cap-track {
	background: rgba(52, 199, 89, 0.14);
	border-color: rgba(52, 199, 89, 0.45);
}

.yc-cap-overlay.is-success .yc-cap-progress {
	background: rgba(52, 199, 89, 0.25);
}

.yc-cap-overlay.is-success .yc-cap-handle {
	border-color: #34c759;
}

.yc-cap-overlay.is-success .yc-cap-arrow::before {
	border-color: #34c759;
}

.yc-cap-overlay.is-success .yc-cap-track-label {
	color: #34c759;
}

/* 错误态 */
.yc-cap-overlay.is-error .yc-cap-track {
	background: rgba(255, 59, 48, 0.1);
	border-color: rgba(255, 59, 48, 0.4);
}

.yc-cap-overlay.is-error .yc-cap-progress {
	background: rgba(255, 59, 48, 0.18);
}

.yc-cap-overlay.is-error .yc-cap-handle {
	border-color: #ff3b30;
}

.yc-cap-overlay.is-error .yc-cap-arrow::before {
	border-color: #ff3b30;
}

@media (max-width: 400px) {
	.yc-cap-card {
		padding: 16px;
		border-radius: 14px;
	}

	.yc-cap-frame {
		margin-top: 12px;
	}

	.yc-cap-track {
		margin-top: 12px;
	}
}
