/* =========================================================
   Zibll 访问问答验证 - 前端验证页样式
   说明：验证页为独立页面，不加载子比主题样式，避免任何冲突。
   所有类名统一使用 zaq- 前缀。
   ========================================================= */

:root {
	--zaq-accent: #5b6cff;
	--zaq-accent-2: #8b5cf6;
	--zaq-bg: #eef3ff;
	--zaq-card-bg: #ffffff;
	--zaq-text: #17203a;
	--zaq-muted: #6d789a;
	--zaq-border: #e4e9f7;
	--zaq-input-bg: #f7f9ff;
	--zaq-input-border: #dfe5f5;
	--zaq-error: #e5484d;
	--zaq-error-bg: #fdecec;
	--zaq-success: #10a05a;
	--zaq-success-bg: #e8f9f0;
	--zaq-shadow: 0 28px 70px rgba(35, 54, 120, 0.16);
	--zaq-glow-1: rgba(91, 108, 255, 0.20);
	--zaq-glow-2: rgba(139, 92, 246, 0.16);
}

/* 跟随系统深色模式 */
@media (prefers-color-scheme: dark) {
	:root {
		--zaq-bg: #0b1020;
		--zaq-card-bg: #151b2e;
		--zaq-text: #edf1ff;
		--zaq-muted: #9aa5c4;
		--zaq-border: #26304a;
		--zaq-input-bg: #0f1526;
		--zaq-input-border: #2b3654;
		--zaq-error-bg: rgba(229, 72, 77, 0.14);
		--zaq-success-bg: rgba(16, 160, 90, 0.16);
		--zaq-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
		--zaq-glow-1: rgba(91, 108, 255, 0.18);
		--zaq-glow-2: rgba(139, 92, 246, 0.14);
	}
}

/* 用户手动切换后的强制主题（优先级高于系统主题） */
:root[data-zaq-theme="light"] {
	--zaq-bg: #eef3ff;
	--zaq-card-bg: #ffffff;
	--zaq-text: #17203a;
	--zaq-muted: #6d789a;
	--zaq-border: #e4e9f7;
	--zaq-input-bg: #f7f9ff;
	--zaq-input-border: #dfe5f5;
	--zaq-error-bg: #fdecec;
	--zaq-success-bg: #e8f9f0;
	--zaq-shadow: 0 28px 70px rgba(35, 54, 120, 0.16);
}

:root[data-zaq-theme="dark"] {
	--zaq-bg: #0b1020;
	--zaq-card-bg: #151b2e;
	--zaq-text: #edf1ff;
	--zaq-muted: #9aa5c4;
	--zaq-border: #26304a;
	--zaq-input-bg: #0f1526;
	--zaq-input-border: #2b3654;
	--zaq-error-bg: rgba(229, 72, 77, 0.14);
	--zaq-success-bg: rgba(16, 160, 90, 0.16);
	--zaq-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body.zaq-body {
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	background: var(--zaq-bg);
	color: var(--zaq-text);
	overflow: hidden; /* 禁止底层内容滚动 */
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

[hidden] {
	display: none !important;
}

/* 居中遮罩：视觉上等同弹窗背景 */
.zaq-overlay {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	overflow: hidden;
	background:
		radial-gradient(1100px 560px at 12% -5%, var(--zaq-glow-1), transparent 62%),
		radial-gradient(900px 520px at 92% 105%, var(--zaq-glow-2), transparent 58%),
		var(--zaq-bg);
	animation: zaq-fade-in 0.4s ease both;
}

.zaq-overlay::before,
.zaq-overlay::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	filter: blur(2px);
	opacity: 0.5;
	pointer-events: none;
}

.zaq-overlay::before {
	width: 280px;
	height: 280px;
	top: -120px;
	right: -80px;
	background: linear-gradient(135deg, rgba(91, 108, 255, 0.22), rgba(139, 92, 246, 0.05));
}

.zaq-overlay::after {
	width: 220px;
	height: 220px;
	bottom: -100px;
	left: -70px;
	background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(91, 108, 255, 0.04));
}

/* 验证卡片 */
.zaq-card {
	position: relative;
	width: 100%;
	max-width: 476px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	padding: 30px 32px 22px;
	background: var(--zaq-card-bg);
	border: 1px solid var(--zaq-border);
	border-radius: 20px;
	box-shadow: var(--zaq-shadow);
	-webkit-overflow-scrolling: touch;
}

.zaq-card.is-shake {
	animation: zaq-shake 0.42s ease;
}

/* 右下角主题切换按钮 */
.zaq-theme-toggle {
	position: absolute;
	top: 14px;
	right: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	color: var(--zaq-muted);
	background: transparent;
	border: 1px solid transparent;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.zaq-theme-toggle:hover {
	color: var(--zaq-text);
	background: var(--zaq-input-bg);
	border-color: var(--zaq-border);
}

/* 站点品牌 */
.zaq-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 22px;
	padding-right: 40px;
}

.zaq-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	flex: none;
	color: #ffffff;
	background: linear-gradient(135deg, var(--zaq-accent), var(--zaq-accent-2));
	border-radius: 11px;
	box-shadow: 0 8px 18px rgba(91, 108, 255, 0.3);
}

.zaq-brand-name {
	min-width: 0;
	overflow: hidden;
	color: var(--zaq-muted);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.2px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.zaq-title {
	margin: 0 0 8px;
	font-size: 25px;
	line-height: 1.3;
	font-weight: 700;
	letter-spacing: 0.3px;
}

.zaq-subtitle {
	margin: 0 0 18px;
	color: var(--zaq-muted);
	font-size: 13.5px;
	line-height: 1.6;
}

.zaq-subtitle strong {
	color: var(--zaq-accent);
	font-weight: 700;
}

/* 进度条 */
.zaq-progress {
	height: 6px;
	margin-bottom: 10px;
	overflow: hidden;
	background: var(--zaq-input-bg);
	border-radius: 999px;
}

.zaq-progress span {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--zaq-accent), var(--zaq-accent-2));
	border-radius: inherit;
	transition: width 0.32s ease;
}

.zaq-step-label {
	margin: 0 0 18px;
	color: var(--zaq-muted);
	font-size: 12px;
	letter-spacing: 0.4px;
}

/* 问题与输入框 */
.zaq-step {
	animation: zaq-step-in 0.28s ease both;
}

.zaq-question {
	display: block;
	margin-bottom: 10px;
	color: var(--zaq-text);
	font-size: 15.5px;
	line-height: 1.7;
	font-weight: 600;
	word-break: break-word;
}

.zaq-input {
	display: block;
	width: 100%;
	height: 48px;
	padding: 0 15px;
	color: var(--zaq-text);
	font-size: 15px;
	font-family: inherit;
	background: var(--zaq-input-bg);
	border: 1.5px solid var(--zaq-input-border);
	border-radius: 12px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
	-webkit-appearance: none;
	appearance: none;
}

.zaq-input::placeholder {
	color: var(--zaq-muted);
	opacity: 0.7;
}

.zaq-input:focus {
	background: var(--zaq-card-bg);
	border-color: var(--zaq-accent);
	box-shadow: 0 0 0 4px rgba(91, 108, 255, 0.14);
}

/* 提示信息 */
.zaq-msg {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin: 14px 0 0;
	padding: 10px 13px;
	font-size: 13px;
	line-height: 1.55;
	border-radius: 10px;
	word-break: break-word;
}

.zaq-msg.is-error {
	color: var(--zaq-error);
	background: var(--zaq-error-bg);
}

.zaq-msg.is-success {
	color: var(--zaq-success);
	background: var(--zaq-success-bg);
}

.zaq-msg .zaq-detail {
	opacity: 0.82;
	font-size: 12px;
}

/* 提交按钮 */
.zaq-actions {
	margin-top: 20px;
}

.zaq-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: 48px;
	padding: 0 18px;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	line-height: 1;
	text-decoration: none;
	text-align: center;
	background: linear-gradient(135deg, var(--zaq-accent), var(--zaq-accent-2));
	border: none;
	border-radius: 12px;
	box-shadow: 0 10px 22px rgba(91, 108, 255, 0.28);
	cursor: pointer;
	transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
	-webkit-appearance: none;
	appearance: none;
}

.zaq-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 26px rgba(91, 108, 255, 0.34);
}

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

.zaq-btn:disabled,
.zaq-btn.is-loading {
	opacity: 0.72;
	cursor: not-allowed;
	transform: none;
}

.zaq-btn-text {
	transition: opacity 0.2s;
}

.zaq-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.45);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: zaq-spin 0.7s linear infinite;
}

.zaq-btn.is-loading .zaq-spinner {
	display: inline-block;
}

/* 返回上一题 */
.zaq-back {
	display: block;
	width: 100%;
	margin-top: 12px;
	padding: 6px 0;
	color: var(--zaq-muted);
	font-size: 13px;
	font-family: inherit;
	text-align: center;
	background: none;
	border: none;
	cursor: pointer;
	transition: color 0.2s;
}

.zaq-back:hover {
	color: var(--zaq-accent);
}

.zaq-footnote {
	margin: 18px 0 0;
	color: var(--zaq-muted);
	font-size: 12px;
	line-height: 1.6;
	text-align: center;
}

.zaq-noscript {
	margin: 14px 0 0;
	padding: 10px 13px;
	color: var(--zaq-error);
	font-size: 13px;
	background: var(--zaq-error-bg);
	border-radius: 10px;
}

.zaq-copyright {
	margin: 16px 0 0;
	padding-top: 14px;
	color: var(--zaq-muted);
	font-size: 11px;
	letter-spacing: 0.3px;
	text-align: center;
	border-top: 1px solid var(--zaq-border);
	opacity: 0.8;
}

/* 验证成功面板 */
.zaq-success {
	padding: 14px 0 6px;
	text-align: center;
	animation: zaq-step-in 0.35s ease both;
}

.zaq-success-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin-bottom: 16px;
	color: var(--zaq-success);
	background: var(--zaq-success-bg);
	border-radius: 50%;
	animation: zaq-pop 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.zaq-success h2 {
	margin: 0 0 8px;
	color: var(--zaq-success);
	font-size: 22px;
	font-weight: 700;
}

.zaq-success p {
	margin: 0 0 20px;
	color: var(--zaq-muted);
	font-size: 14px;
	line-height: 1.7;
}

.zaq-success p strong {
	color: var(--zaq-success);
	font-size: 17px;
}

/* 动画 */
@keyframes zaq-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes zaq-step-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes zaq-pop {
	from {
		opacity: 0;
		transform: scale(0.7);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes zaq-spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes zaq-shake {
	0%,
	100% {
		transform: translateX(0);
	}
	20% {
		transform: translateX(-6px);
	}
	40% {
		transform: translateX(6px);
	}
	60% {
		transform: translateX(-4px);
	}
	80% {
		transform: translateX(4px);
	}
}

/* 移动端适配 */
@media (max-width: 520px) {
	.zaq-overlay {
		padding: 12px;
	}

	.zaq-card {
		max-width: 100%;
		padding: 26px 20px 18px;
		border-radius: 18px;
	}

	.zaq-title {
		font-size: 22px;
	}

	.zaq-brand {
		margin-bottom: 18px;
	}

	.zaq-question {
		font-size: 15px;
	}

	.zaq-input,
	.zaq-btn {
		height: 46px;
		font-size: 15px;
	}

	.zaq-theme-toggle {
		top: 10px;
		right: 10px;
	}
}

/* 尊重用户的「减少动画」偏好 */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
