/**
 * 绿叶链落地页样式（移动优先，含深色模式适配；品牌色 #14b8a6）
 */

:root {
	--brand: #14b8a6;
	--brand-deep: #0f9d8f;
	--brand-soft: rgba(20, 184, 166, .08);
	--bg: #f1f5f9;
	--card: #ffffff;
	--text: #0f172a;
	--sub: #64748b;
	--line: #e8eef3;
	--shadow: 0 10px 40px rgba(13, 148, 136, .10);
	--mask: rgba(15, 23, 42, .5);
}

@media (prefers-color-scheme: dark) {
	:root {
		--brand: #2dd4bf;
		--brand-deep: #14b8a6;
		--brand-soft: rgba(45, 212, 191, .10);
		--bg: #0f172a;
		--card: #1e293b;
		--text: #f1f5f9;
		--sub: #94a3b8;
		--line: #334155;
		--shadow: none;
		--mask: rgba(0, 0, 0, .6);
	}
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

button {
	font-family: inherit;
}

button:not(:disabled) {
	cursor: pointer;
}

html, body {
	min-height: 100%;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	font-size: 14px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

.hidden {
	display: none !important;
}

#app {
	max-width: 430px;
	margin: 0 auto;
	padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- 状态页（加载/停用/错误） ---------- */

.state {
	padding: 80px 0;
	text-align: center;
}

.state-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 18px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	font-weight: 700;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
	color: #fff;
}

.state-title {
	font-size: 17px;
	font-weight: 600;
	margin-bottom: 8px;
}

.state-text {
	font-size: 13px;
	color: var(--sub);
}

.btn-ghost {
	min-width: 160px;
	height: 46px;
	margin-top: 20px;
	padding: 0 32px;
	border: 1px solid var(--brand);
	border-radius: 12px;
	background: var(--brand-soft);
	color: var(--brand-deep);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 1px;
	transition: transform .12s ease, opacity .12s ease;
}

@media (prefers-color-scheme: dark) {
	.btn-ghost {
		color: var(--brand);
	}
}

.btn-ghost:active {
	transform: scale(.97);
	opacity: .92;
}

.spinner {
	width: 32px;
	height: 32px;
	margin: 0 auto 16px;
	border: 3px solid var(--brand-soft);
	border-top-color: var(--brand);
	border-radius: 50%;
	animation: spin .8s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

/* ---------- 名片头部 ---------- */

.profile {
	text-align: center;
	margin-bottom: 20px;
	animation: rise .35s ease both;
}

.avatar-wrap {
	width: 72px;
	height: 72px;
	margin: 0 auto 12px;
}

.avatar,
.avatar-fallback {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	display: block;
	object-fit: cover;
}

.avatar-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
}

.avatar-fallback.hidden {
	display: none !important;
}

.name {
	font-size: 20px;
	font-weight: 600;
	line-height: 1.4;
	word-break: break-all;
}

.sub {
	font-size: 13px;
	color: var(--sub);
	margin-top: 2px;
	word-break: break-all;
}

/* ---------- 信息卡片 ---------- */

.card {
	background: var(--card);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: 6px 18px;
	margin-bottom: 14px;
	animation: rise .35s ease both;
}

.info-list {
	list-style: none;
}

.info-row {
	display: flex;
	align-items: flex-start;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}

.info-row:last-child {
	border-bottom: 0;
}

.info-label {
	flex: 0 0 76px;
	color: var(--sub);
	font-size: 13px;
}

.info-value {
	flex: 1;
	text-align: right;
	color: var(--text);
	font-size: 14px;
	word-break: break-all;
	white-space: pre-wrap;
}

.section-title {
	font-size: 14px;
	font-weight: 600;
	padding: 12px 0 2px;
}

/* ---------- 购买按钮 ---------- */

.cta-wrap {
	margin: 18px 0 14px;
	animation: rise .4s ease both;
}

.btn-buy {
	width: 100%;
	height: 52px;
	border: 0;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
	color: #fff;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: 2px;
	box-shadow: 0 8px 24px rgba(13, 148, 136, .28);
	transition: transform .12s ease, opacity .12s ease;
}

.btn-buy:active {
	transform: scale(.97);
	opacity: .92;
}

/* ---------- 拼号列表 ---------- */

.groupbuy-list {
	list-style: none;
	padding: 8px 0 12px;
}

.groupbuy-list li + li {
	margin-top: 10px;
}

.btn-groupbuy {
	width: 100%;
	height: 46px;
	border: 1px solid var(--brand);
	border-radius: 12px;
	background: var(--brand-soft);
	color: var(--brand-deep);
	font-size: 15px;
	font-weight: 500;
	transition: transform .12s ease;
}

@media (prefers-color-scheme: dark) {
	.btn-groupbuy {
		color: var(--brand);
	}
}

.btn-groupbuy:active {
	transform: scale(.98);
}

/* ---------- 底部 ---------- */

.footer {
	text-align: center;
	margin-top: 22px;
}

.btn-feedback {
	border: 0;
	background: none;
	color: var(--sub);
	font-size: 13px;
	text-decoration: underline;
	text-underline-offset: 3px;
	padding: 6px 10px;
}

.btn-feedback[disabled] {
	color: var(--brand);
	text-decoration: none;
}

.fb-hint {
	font-size: 12px;
	color: var(--sub);
	margin-top: 6px;
	padding: 0 12px;
}

.powered {
	font-size: 11px;
	color: var(--sub);
	opacity: .75;
	margin-top: 14px;
}

/* ---------- 跳转失败提示浮层 ---------- */

.open-tip {
	position: fixed;
	inset: 0;
	background: var(--mask);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	z-index: 99;
}

.open-tip-panel {
	width: 100%;
	max-width: 320px;
	background: var(--card);
	border-radius: 16px;
	padding: 24px 20px;
	text-align: center;
	animation: rise .25s ease both;
}

.open-tip-title {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 8px;
}

.open-tip-text {
	font-size: 13px;
	color: var(--sub);
	margin-bottom: 18px;
}

.btn-copy {
	width: 100%;
	height: 46px;
	border: 0;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
}

.btn-copy:active {
	opacity: .92;
}

.btn-close {
	width: 100%;
	height: 42px;
	margin-top: 10px;
	border: 0;
	background: none;
	color: var(--sub);
	font-size: 14px;
}

/* ---------- 进入动画 ---------- */

@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------- 地图导航按钮（地址行内联） ---------- */

.btn-map {
	display: inline-block;
	margin-top: 8px;
	padding: 3px 12px;
	border: 1px solid var(--brand);
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand-deep);
	font-size: 12px;
	line-height: 1.7;
	transition: transform .12s ease;
}

.btn-map:active {
	transform: scale(.97);
}

@media (prefers-color-scheme: dark) {
	.btn-map {
		color: var(--brand);
	}
}

/* ---------- 版式：顶部横幅（banner） ---------- */

body.tpl-banner #app {
	padding-top: 0;
}

body.tpl-banner .profile {
	margin: 0 -16px 18px;
	padding: calc(44px + env(safe-area-inset-top)) 16px 30px;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
}

body.tpl-banner .avatar,
body.tpl-banner .avatar-fallback {
	border: 3px solid rgba(255, 255, 255, .7);
}

body.tpl-banner .avatar-fallback {
	background: rgba(255, 255, 255, .22);
}

body.tpl-banner .name {
	color: #fff;
}

body.tpl-banner .sub {
	color: rgba(255, 255, 255, .85);
}

/* ---------- 版式：极简列表（minimal） ---------- */

body.tpl-minimal #app {
	padding-top: 20px;
}

/* 头像与姓名/单位两行组成 2×2 grid（DOM 为三个兄弟节点，必须显式跨行） */
body.tpl-minimal .profile {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-rows: auto auto;
	align-items: center;
	column-gap: 12px;
	text-align: left;
	margin-bottom: 16px;
}

body.tpl-minimal .avatar-wrap {
	grid-row: 1 / 3;
	width: 52px;
	height: 52px;
	margin: 0;
}

body.tpl-minimal .avatar,
body.tpl-minimal .avatar-fallback {
	width: 52px;
	height: 52px;
	border-radius: 14px;
	font-size: 20px;
}

body.tpl-minimal .name {
	font-size: 17px;
}

body.tpl-minimal .card {
	box-shadow: none;
	border: 1px solid var(--line);
}

body.tpl-minimal .info-row {
	padding: 10px 0;
}

body.tpl-minimal .btn-buy {
	box-shadow: none;
}
