:root {
	--green: #08ad67;
	--green-dark: #078b55;
	--green-soft: #eaf9f2;
	--text: #20252b;
	--muted: #8a9199;
	--line: #edf0f2;
	--background: #f4f6f8;
	--card: #ffffff;
	--danger: #d94c4c;
	--radius: 6px;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
	background: var(--background);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
		"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	-webkit-font-smoothing: antialiased;
}

body {
	overflow-x: hidden;
}

button,
input,
textarea {
	font: inherit;
}

button,
a {
	-webkit-tap-highlight-color: transparent;
}

.h5-app {
	width: 100%;
	max-width: 480px;
	min-height: 100vh;
	margin: 0 auto;
	background: var(--background);
	box-shadow: 0 0 24px rgba(20, 35, 28, 0.04);
}

.h5-topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	padding: env(safe-area-inset-top) 16px 0;
	background: rgba(255, 255, 255, 0.96);
	border-bottom: 1px solid var(--line);
	backdrop-filter: blur(10px);
}

.h5-topbar h1 {
	max-width: 100%;
	margin: 0;
	overflow: hidden;
	font-size: 18px;
	font-weight: 650;
	line-height: 52px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.h5-main {
	padding: 14px 14px calc(102px + env(safe-area-inset-bottom));
}

.content-card,
.empty-card,
.status-card {
	margin-bottom: 14px;
	padding: 18px;
	border: 1px solid var(--line);
	background: var(--card);
	border-radius: var(--radius);
	box-shadow: none;
}

.content-card h2,
.content-card h3,
.empty-card h2,
.status-card h2 {
	margin-top: 0;
}

.content-card h3 {
	margin-bottom: 14px;
	font-size: 17px;
}

.muted {
	color: var(--muted);
	font-size: 14px;
	line-height: 1.65;
}

/* 商品主图：4:3 白底画布，图片按 contain 完整显示，不会被裁掉。
   客户多是用手机拍的横图（16:9/4:3），画布用 1:1 会上下留出大片白边。 */
.product-gallery-wrap {
	position: relative;
	margin: -14px -14px 14px;
	overflow: hidden;
	background: #ffffff;
	border-radius: 0;
	box-shadow: none;
}

.product-gallery {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
}

.product-gallery::-webkit-scrollbar {
	display: none;
}

.gallery-frame {
	position: relative;
	width: 100%;
	min-width: 100%;
	padding-bottom: 75%;
	scroll-snap-align: center;
}

.gallery-frame img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.gallery-dots {
	position: absolute;
	left: 50%;
	bottom: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 6px;
	transform: translateX(-50%);
}

.gallery-dot {
	width: 6px;
	height: 6px;
	background: rgba(32, 37, 43, 0.16);
	border-radius: 3px;
	transition: width 0.2s, background-color 0.2s;
}

.gallery-dot.active {
	width: 16px;
	background: var(--green);
}

.product-summary h2 {
	margin-bottom: 12px;
	font-size: 21px;
	line-height: 1.45;
}

.product-summary .price-line strong {
	font-size: 27px;
}

/* 卡密输入区做成紧凑版：标题和提示同一行，卡号卡密并排，省掉一整行标签的高度。 */
.redeem-card {
	padding: 16px;
}

.redeem-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.redeem-card h3 {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-bottom: 0;
}

.redeem-hint {
	margin: 0;
	color: var(--muted);
	font-size: 12px;
}

.redeem-fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 14px;
}

.redeem-card .primary-button {
	min-height: 46px;
	margin-top: 14px;
}

.redeem-icon {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	background: var(--green-soft);
	border-radius: 6px;
	color: var(--green-dark);
	font-size: 15px;
	font-weight: 600;
}

.price-line {
	display: flex;
	align-items: baseline;
	gap: 10px;
}

.price-line strong,
.order-product strong,
.submit-bar strong {
	color: var(--green);
	font-size: 24px;
}

.price-line del {
	color: #a5aab0;
	font-size: 14px;
}

.field-label {
	display: block;
	margin: 16px 2px 8px;
	font-size: 15px;
	font-weight: 600;
}

.text-input {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 12px 14px;
	color: var(--text);
	background: #f8f9fa;
	border: 1px solid #e4e8eb;
	border-radius: 6px;
	font-size: 16px;
	line-height: 22px;
	outline: 0;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus {
	background: #ffffff;
	border-color: var(--green);
	box-shadow: 0 0 0 3px rgba(8, 173, 103, 0.1);
}

.text-area {
	min-height: 94px;
	resize: vertical;
}

.short-area {
	min-height: 76px;
}

.primary-button,
.secondary-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 50px;
	padding: 12px 18px;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	font-size: 17px;
	font-weight: 650;
	text-align: center;
	text-decoration: none;
}

.primary-button {
	margin-top: 20px;
	background: var(--green);
	color: #ffffff;
}

.primary-button:active {
	background: var(--green-dark);
}

.primary-button:disabled {
	cursor: not-allowed;
	opacity: 0.58;
}

.secondary-button {
	margin-top: 18px;
	background: var(--green-soft);
	color: var(--green-dark);
}

.rich-content {
	overflow: hidden;
	font-size: 15px;
	line-height: 1.75;
}

.rich-content img,
.rich-content video,
.rich-content table {
	max-width: 100% !important;
	height: auto !important;
}

.notice-content p {
	margin-bottom: 0;
	font-size: 14px;
	line-height: 1.8;
	white-space: normal;
	word-break: break-word;
}

.order-product {
	display: flex;
	align-items: center;
	gap: 14px;
}

.order-product img {
	width: 92px;
	height: 92px;
	flex: 0 0 auto;
	background: #f1f3f4;
	border-radius: 6px;
	object-fit: cover;
}

.order-product div {
	min-width: 0;
	flex: 1;
}

.order-product h2 {
	margin: 0 0 9px;
	font-size: 17px;
	line-height: 1.45;
}

.order-product p {
	margin: 7px 0 0;
	color: var(--muted);
	font-size: 14px;
}

.form-card h3 {
	padding-bottom: 12px;
	border-bottom: 1px solid var(--line);
}

.region-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.submit-bar {
	position: sticky;
	bottom: calc(68px + env(safe-area-inset-bottom));
	z-index: 12;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 18px 0 0;
	padding: 10px 12px;
	background: rgba(255, 255, 255, 0.97);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: 0 8px 28px rgba(25, 42, 34, 0.12);
}

.submit-bar > div {
	min-width: 110px;
	padding-left: 6px;
}

.submit-bar span {
	display: block;
	color: var(--muted);
	font-size: 12px;
}

.submit-bar strong {
	font-size: 19px;
}

.submit-bar .primary-button {
	min-height: 46px;
	margin: 0;
	flex: 1;
}

.order-list {
	display: grid;
	gap: 14px;
}

.order-item {
	display: block;
	margin: 0;
	color: inherit;
	text-decoration: none;
}

.order-item-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 15px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--line);
	font-size: 12px;
}

.order-item-head span {
	min-width: 0;
	overflow: hidden;
	color: var(--muted);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.order-item-head strong {
	flex: 0 0 auto;
	color: var(--green);
	font-size: 14px;
}

.order-product.compact {
	padding: 0;
}

.order-product.compact img {
	width: 72px;
	height: 72px;
}

.order-product.compact strong {
	font-size: 16px;
}

.status-card {
	background: linear-gradient(135deg, var(--green), #38c88d);
	color: #ffffff;
}

.status-card span,
.status-card p {
	opacity: 0.9;
}

.status-card h2 {
	margin: 7px 0;
	font-size: 26px;
}

.status-card p {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
}

.detail-list h3 {
	padding-bottom: 11px;
	border-bottom: 1px solid var(--line);
}

.detail-list > div {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	padding: 10px 0;
	font-size: 14px;
	line-height: 1.6;
}

.detail-list span {
	flex: 0 0 auto;
	color: var(--muted);
}

.detail-list strong {
	font-weight: 500;
	text-align: right;
	word-break: break-all;
}

.detail-list .multiline strong {
	max-width: 72%;
}

.link-button {
	margin-bottom: 14px;
}

.empty-card {
	padding: 54px 24px;
	text-align: center;
}

.empty-icon,
.notice-mark {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	margin: 0 auto 18px;
	background: var(--green-soft);
	border-radius: 50%;
	color: var(--green);
	font-size: 30px;
	font-weight: 700;
}

.empty-card h2 {
	font-size: 19px;
}

.empty-card p {
	color: var(--muted);
	font-size: 14px;
	line-height: 1.7;
}

.service-float {
	position: fixed;
	right: max(16px, calc((100vw - 480px) / 2 + 16px));
	bottom: calc(86px + env(safe-area-inset-bottom));
	z-index: 25;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	padding: 0;
	background: #ffffff;
	border: 1px solid rgba(8, 173, 103, 0.18);
	border-radius: 50%;
	box-shadow: 0 6px 22px rgba(23, 44, 34, 0.16);
	color: var(--green);
	font-size: 11px;
}

.service-icon {
	font-size: 20px;
	line-height: 21px;
}

/* 有吸底购买条的页面，客服按钮要抬到购买条上方，否则两个按钮会叠在一起。 */
.service-float-lift {
	bottom: calc(150px + env(safe-area-inset-bottom));
}

.bottom-nav {
	position: fixed;
	left: 50%;
	bottom: 0;
	z-index: 22;
	display: grid;
	grid-template-columns: 1fr 1fr;
	width: 100%;
	max-width: 480px;
	min-height: calc(64px + env(safe-area-inset-bottom));
	padding-bottom: env(safe-area-inset-bottom);
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.98);
	border-top: 1px solid var(--line);
}

.bottom-nav a {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 64px;
	color: #8d949a;
	font-size: 12px;
	text-decoration: none;
}

.bottom-nav a.active {
	color: var(--green);
}

.nav-icon {
	font-size: 22px;
	line-height: 25px;
}

.dialog-mask {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(8, 16, 12, 0.46);
}

.dialog-mask[hidden],
.toast[hidden] {
	display: none;
}

.service-dialog {
	width: 100%;
	max-width: 350px;
	padding: 24px;
	background: #ffffff;
	border-radius: 8px;
	text-align: center;
}

.service-dialog h2 {
	margin: 0 0 18px;
	font-size: 20px;
}

.service-line {
	display: block;
	min-height: 44px;
	padding: 11px 8px;
	color: var(--green-dark);
	text-decoration: none;
}

.toast {
	position: fixed;
	left: 50%;
	top: 46%;
	z-index: 70;
	max-width: calc(100% - 56px);
	padding: 12px 18px;
	transform: translate(-50%, -50%);
	background: rgba(25, 27, 26, 0.86);
	border-radius: 6px;
	color: #ffffff;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
}

@media (max-width: 360px) {
	.h5-main {
		padding-right: 10px;
		padding-left: 10px;
	}

	.product-gallery-wrap {
		margin-right: -10px;
		margin-left: -10px;
	}

	.region-grid {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 481px) {
	body {
		padding: 20px 0;
	}

	.h5-app {
		min-height: calc(100vh - 40px);
		border-radius: 8px;
		overflow: hidden;
	}
}
