/*
	奇妙创思 — 登录 / 注册
	独立于 main.css，不覆写模板原有规则
*/

/* ============================================================
   1. 变量
   ============================================================ */

:root {
	--auth-green: #98c593;
	--auth-green-hover: #a8cea4;
	--auth-green-active: #88bc82;
	--auth-line: #e5e6e7;
	--auth-focus: #9ac8e9;
	--auth-text: #39454b;
	--auth-muted: #8d989e;
	--auth-error: #d9705f;
}

/* ============================================================
   2. Header 入口（桌面：nav 内；移动：右上角 FAB）
   ============================================================ */

#header nav ul li.auth-entry {
	margin-left: 0.75em;
	vertical-align: middle;
}

.auth-fab {
	position: absolute;
	right: 0.75em;
	top: 50%;
	transform: translateY(-50%);
	display: none;
	z-index: 2;
}

/* 未登录：胶囊按钮 */
.auth-btn {
	-webkit-appearance: none;
	appearance: none;
	display: inline-block;
	height: 2.2em;
	line-height: 2.2em;
	padding: 0 1.2em;
	font-size: 0.85em;
	font-weight: 300;
	letter-spacing: 0.025em;
	color: #ffffff;
	background-color: var(--auth-green);
	border: 0;
	border-radius: 2em;
	cursor: pointer;
	outline: 0;
	white-space: nowrap;
	transition: background-color 0.2s ease-in-out;
}

.auth-btn:hover { background-color: var(--auth-green-hover); }
.auth-btn:active { background-color: var(--auth-green-active); }

/* 已登录：用户名 + 下拉 */
.auth-user-wrap {
	position: relative;
	display: inline-block;
	vertical-align: middle;
}

.auth-user {
	-webkit-appearance: none;
	appearance: none;
	display: inline-block;
	max-width: 11em;
	height: 2.2em;
	line-height: 2.1em;
	padding: 0 0.9em;
	font-size: 0.85em;
	font-weight: 300;
	letter-spacing: 0.025em;
	color: var(--auth-text);
	background-color: transparent;
	border: solid 2px var(--auth-line);
	border-radius: 2em;
	cursor: pointer;
	outline: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.auth-user:hover {
	border-color: var(--auth-green);
	background-color: rgba(152, 197, 147, 0.08);
}

.auth-user .auth-caret {
	display: inline-block;
	margin-left: 0.4em;
	font-size: 0.7em;
	color: var(--auth-muted);
}

.auth-menu {
	position: absolute;
	right: 0;
	top: calc(100% + 0.5em);
	margin: 0 !important;
	padding: 0.4em 0 !important;
	min-width: 9em;
	list-style: none;
	background: #ffffff;
	border: solid 1px var(--auth-line);
	border-radius: 0.5em;
	box-shadow: 0 0.3em 1.2em rgba(57, 69, 75, 0.14);
	font-size: 0.85em;
	line-height: 1.6;
	text-align: left;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-0.3em);
	transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out, visibility 0.15s;
}

.auth-menu.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

#header nav ul .auth-menu li,
.auth-menu li {
	display: block !important;
	margin: 0 !important;
	font-size: 1em !important;
}

.auth-menu button {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	height: auto;
	padding: 0.5em 1em;
	font-size: 1em;
	font-weight: 300;
	line-height: 1.6;
	text-align: left;
	color: var(--auth-text);
	background: transparent;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	white-space: nowrap;
}

.auth-menu button:hover { background-color: rgba(152, 197, 147, 0.12); }
.auth-menu button.is-danger { color: var(--auth-error); }
.auth-menu button.is-danger:hover { background-color: rgba(217, 112, 95, 0.1); }

@media screen and (max-width: 736px) {
	#header nav ul li.auth-entry { display: none; }
	.auth-fab { display: block; }
	.auth-fab .auth-btn,
	.auth-fab .auth-user { font-size: 0.8em; }
	.auth-fab .auth-user { max-width: 7.5em; }
}

/* ============================================================
   3. 遮罩与弹窗
   ============================================================ */

.auth-overlay {
	position: fixed;
	z-index: 10050;   /* > #header(10000) 与 poptrox baseZIndex(10001) */
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	background: rgba(37, 45, 50, 0.62);
	font-size: 16px;
	line-height: 1.6;
	color: var(--auth-text);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.22s ease-in-out, visibility 0.22s;
	-webkit-overflow-scrolling: touch;
	overflow-y: auto;
}

.auth-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.auth-modal {
	position: relative;
	width: 100%;
	max-width: 22.5rem;
	padding: 2rem 1.75rem 1.5rem;
	background: #ffffff;
	border-radius: 0.75rem;
	box-shadow: 0 1.5rem 3rem rgba(37, 45, 50, 0.25);
	transform: translateY(1.2rem) scale(0.98);
	transition: transform 0.22s ease-in-out;
}

.auth-overlay.is-open .auth-modal { transform: translateY(0) scale(1); }

.auth-close {
	-webkit-appearance: none;
	appearance: none;
	position: absolute;
	right: 0.6rem;
	top: 0.6rem;
	width: 2rem;
	height: 2rem;
	padding: 0;
	line-height: 1;
	font-size: 1.4rem;
	color: var(--auth-muted);
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: color 0.2s, background-color 0.2s;
}

.auth-close:hover {
	color: var(--auth-text);
	background: rgba(229, 230, 231, 0.6);
}

.auth-title {
	margin: 0 0 0.35rem;
	font-size: 1.35rem;
	font-weight: 300;
	line-height: 1.4;
	letter-spacing: 0.05em;
	color: var(--auth-text);
}

.auth-sub {
	margin: 0 0 1.5rem;
	font-size: 0.85rem;
	line-height: 1.5;
	color: var(--auth-muted);
}

/* ============================================================
   4. 表单
   ============================================================ */

.auth-step { display: none; }
.auth-step.is-active { display: block; }

.auth-field { margin-bottom: 0.9rem; }

.auth-modal input[type="tel"],
.auth-modal input[type="text"] {
	display: block;
	width: 100%;
	height: 3rem;
	padding: 0 0.9rem;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 300;
	line-height: 3rem;
	letter-spacing: 0.025em;
	color: var(--auth-text);
	background: none;
	border: solid 2px var(--auth-line);
	border-radius: 0.5rem;
	outline: none;
	transition: border-color 0.2s ease-in-out;
}

.auth-modal input::placeholder { color: #b9c1c5; opacity: 1; }
.auth-modal input:focus { border-color: var(--auth-focus); }
.auth-modal input.is-error { border-color: var(--auth-error); }

/* 验证码行：输入框 + 获取按钮 */
.auth-field-code {
	display: flex;
	align-items: stretch;
	gap: 0.6rem;
}

.auth-field-code input { flex: 1 1 auto; min-width: 0; }

.auth-code-btn {
	-webkit-appearance: none;
	appearance: none;
	flex: 0 0 auto;
	height: 3rem;
	padding: 0 0.9rem;
	font-family: inherit;
	font-size: 0.82rem;
	font-weight: 300;
	line-height: 1;
	letter-spacing: 0.025em;
	white-space: nowrap;
	color: var(--auth-green);
	background: transparent;
	border: solid 2px var(--auth-line);
	border-radius: 0.5rem;
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s;
}

.auth-code-btn:hover:not(:disabled) { border-color: var(--auth-green); }

.auth-code-btn:disabled {
	color: var(--auth-muted);
	cursor: not-allowed;
	border-color: var(--auth-line);
}

/* 提示信息 */
.auth-msg {
	min-height: 1.4rem;
	margin: 0 0 0.5rem;
	font-size: 0.82rem;
	line-height: 1.4rem;
	color: var(--auth-error);
}

.auth-msg.is-ok { color: var(--auth-green); }

/* 主按钮 */
.auth-submit {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	height: 3rem;
	padding: 0;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 300;
	line-height: 3rem;
	letter-spacing: 0.05em;
	color: #ffffff;
	background-color: var(--auth-green);
	border: 0;
	border-radius: 3rem;
	cursor: pointer;
	transition: background-color 0.2s ease-in-out;
}

.auth-submit:hover:not(:disabled) { background-color: var(--auth-green-hover); }
.auth-submit:active:not(:disabled) { background-color: var(--auth-green-active); }
.auth-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-skip {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	height: auto;
	margin-top: 0.8rem;
	padding: 0.3rem 0;
	font-family: inherit;
	font-size: 0.85rem;
	font-weight: 300;
	line-height: 1.6;
	color: var(--auth-muted);
	background: transparent;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	transition: color 0.2s;
}

.auth-skip:hover { color: var(--auth-text); }

.auth-agree {
	margin: 1.1rem 0 0;
	font-size: 0.75rem;
	line-height: 1.6;
	text-align: center;
	color: var(--auth-muted);
}

/* ============================================================
   5. 滑块拼图验证
   ============================================================ */

/* 作为独立步骤走文档流：浮层在小屏会溢出弹窗并压住标题 */
.auth-captcha { display: none; }
.auth-captcha.is-open { display: block; }

.auth-captcha-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.6rem;
	font-size: 0.82rem;
	line-height: 1.4;
	color: var(--auth-muted);
}

.auth-captcha-head button {
	-webkit-appearance: none;
	appearance: none;
	height: auto;
	padding: 0 0 0 0.6rem;
	font-family: inherit;
	font-size: 0.82rem;
	font-weight: 300;
	line-height: 1.4;
	color: var(--auth-green);
	background: transparent;
	border: 0;
	border-radius: 0;
	cursor: pointer;
}

.auth-captcha-head button:hover { color: var(--auth-green-active); }

.auth-canvas-wrap {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 0.4rem;
	background: #eef0f1;
	line-height: 0;
	user-select: none;
	-webkit-user-select: none;
}

.auth-canvas-wrap canvas { display: block; }

/* 两块画布内部尺寸一致，同时被缩放到容器宽度，因此始终精确重叠 */
.auth-cv-bg,
.auth-cv-piece {
	width: 100%;
	height: auto;
}

.auth-cv-piece {
	position: absolute;
	left: 0;
	top: 0;
	filter: drop-shadow(0 0 3px rgba(37, 45, 50, 0.35));
}

.auth-canvas-flash {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.25s;
	pointer-events: none;
}

.auth-canvas-flash.is-ok { background: rgba(152, 197, 147, 0.45); opacity: 1; }
.auth-canvas-flash.is-fail { background: rgba(217, 112, 95, 0.45); opacity: 1; }

/* 滑动轨道 */
.auth-slider {
	position: relative;
	height: 2.5rem;
	margin-top: 0.7rem;
	background: #f4f5f6;
	border: solid 1px var(--auth-line);
	border-radius: 2.5rem;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}

.auth-slider-fill {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0;
	background: rgba(152, 197, 147, 0.3);
	border-radius: 2.5rem;
}

.auth-slider-label {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	line-height: 2.4rem;
	text-align: center;
	font-size: 0.8rem;
	color: var(--auth-muted);
	pointer-events: none;
}

.auth-slider-handle {
	position: absolute;
	left: 0;
	top: -1px;
	width: 2.9rem;
	height: 2.5rem;
	line-height: 2.4rem;
	text-align: center;
	font-size: 0.95rem;
	color: var(--auth-text);
	background: #ffffff;
	border: solid 1px var(--auth-line);
	border-radius: 2.5rem;
	box-shadow: 0 0.1rem 0.4rem rgba(37, 45, 50, 0.12);
	cursor: grab;
}

.auth-slider-handle:active { cursor: grabbing; }

.auth-slider.is-ok .auth-slider-fill { background: rgba(152, 197, 147, 0.55); }
.auth-slider.is-ok .auth-slider-handle { color: #ffffff; background: var(--auth-green); border-color: var(--auth-green); }
.auth-slider.is-fail .auth-slider-fill { background: rgba(217, 112, 95, 0.35); }
.auth-slider.is-fail .auth-slider-handle { color: #ffffff; background: var(--auth-error); border-color: var(--auth-error); }
.auth-slider.is-moving .auth-slider-label { opacity: 0; }

/* 已通过的静态提示 */
.auth-captcha-pass {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-bottom: 0.9rem;
	padding: 0.5rem 0.8rem;
	font-size: 0.8rem;
	line-height: 1.5;
	color: var(--auth-green);
	background: rgba(152, 197, 147, 0.12);
	border-radius: 0.5rem;
}

/* ============================================================
   6. 小屏适配
   ============================================================ */

@media screen and (max-width: 480px) {
	.auth-overlay { font-size: 15px; padding: 1rem; }
	.auth-modal { padding: 1.75rem 1.25rem 1.25rem; }
	.auth-field-code { gap: 0.5rem; }
	.auth-code-btn { padding: 0 0.7rem; font-size: 0.78rem; }
}

/* 弹窗打开时锁住页面滚动 */
html.auth-locked,
body.auth-locked { overflow: hidden; }
