:root {
	--bg: #f3f1ec;
	--card: #ffffff;
	--ink: #171715;
	--muted: #6e6b64;
	--line: #dedbd3;
	--accent: #20201d;
	--soft: #ece9e1;
	--danger: #b42318;
}

/* =========================
   Base
========================= */

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

/*
 * 很重要：
 * 避免 .progress-panel 的 display:flex 蓋掉 HTML hidden 屬性。
 */
[hidden] {
	display: none !important;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family:
		Inter,
		ui-sans-serif,
		system-ui,
		-apple-system,
		"Segoe UI",
		sans-serif;
}

button,
input,
textarea {
	font: inherit;
}

/* =========================
   Main Layout
========================= */

.page-shell {
	width: min(1180px, calc(100% - 40px));
	margin: 0 auto;
	padding: 72px 0 100px;
	display: grid;
	grid-template-columns: 0.8fr 1.2fr;
	gap: 72px;
	align-items: start;
}

/* =========================
   Hero
========================= */

.hero-copy {
	position: sticky;
	top: 60px;
	padding-top: 24px;
}

.eyebrow {
	display: inline-block;
	margin-bottom: 22px;
	font-size: 12px;
	letter-spacing: 0.18em;
	font-weight: 800;
}

.hero-copy h1 {
	margin: 0;
	font-size: clamp(42px, 5vw, 72px);
	line-height: 1.04;
	letter-spacing: -0.045em;
}

.hero-copy p {
	max-width: 460px;
	margin: 28px 0 0;
	color: var(--muted);
	font-size: 18px;
	line-height: 1.8;
}

/* =========================
   Form Card
========================= */

.form-card {
	position: relative;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 28px;
	padding: 38px;
	box-shadow: 0 24px 80px rgba(35, 31, 24, 0.08);
}

.form-section + .form-section {
	border-top: 1px solid var(--line);
	margin-top: 32px;
	padding-top: 32px;
}

.section-heading {
	display: flex;
	gap: 16px;
	margin-bottom: 24px;
	align-items: flex-start;
}

.section-heading > span {
	display: grid;
	place-items: center;
	flex: 0 0 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--accent);
	color: #fff;
	font-size: 12px;
	font-weight: 800;
}

.section-heading h2 {
	margin: 2px 0 4px;
	font-size: 21px;
}

.section-heading p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.55;
}

/* =========================
   Grid
========================= */

.grid.two {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px;
}

/* =========================
   Form Fields
========================= */

label {
	display: block;
	margin-bottom: 18px;
	font-size: 14px;
	font-weight: 700;
}

label b {
	color: var(--danger);
}

input,
textarea {
	width: 100%;
	margin-top: 9px;
	padding: 14px 15px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #fff;
	color: var(--ink);
	outline: none;
	transition:
		border-color 0.2s,
		box-shadow 0.2s,
		background-color 0.2s;
}

input:focus,
textarea:focus {
	border-color: #8d8a82;
	box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

input:disabled,
textarea:disabled {
	cursor: not-allowed;
}

textarea {
	resize: vertical;
	min-height: 120px;
	line-height: 1.65;
}

/* =========================
   Upload
========================= */

.upload-zone {
	margin: 0;
	border: 1.5px dashed #aaa69b;
	border-radius: 18px;
	min-height: 170px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-align: center;
	cursor: pointer;
	background: #faf9f6;
	transition:
		background-color 0.2s,
		border-color 0.2s,
		transform 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
	background: #f1eee7;
	border-color: #595750;
}

.upload-zone.dragover {
	transform: scale(0.995);
}

.upload-zone input {
	display: none;
}

.upload-zone strong {
	font-size: 16px;
}

.upload-zone small {
	color: var(--muted);
	font-weight: 500;
}

/* =========================
   Image Preview
========================= */

.preview-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-top: 14px;
}

.preview-grid:empty {
	display: none;
}

.preview-grid img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: var(--soft);
}

/* =========================
   Consent
========================= */

.consent {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	color: var(--muted);
	font-weight: 500;
	line-height: 1.55;
}

.consent input {
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	flex: 0 0 auto;
}

/* =========================
   Submit Button
========================= */

.submit-btn {
	width: 100%;
	min-height: 58px;
	margin-top: 12px;
	border: 0;
	border-radius: 14px;
	background: var(--accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 22px;
	font-weight: 800;
	font-size: 16px;
	transition:
		opacity 0.2s,
		transform 0.2s;
}

.submit-btn:hover:not(:disabled) {
	opacity: 0.92;
}

.submit-btn:active:not(:disabled) {
	transform: translateY(1px);
}

.submit-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.submit-btn i {
	font-style: normal;
	font-size: 22px;
}

.form-note {
	text-align: center;
	color: var(--muted);
	font-size: 12px;
	margin: 12px 0 0;
}

/* =========================
   AI Generating State
========================= */

/*
 * 注意：
 * progressPanel 必須在 HTML 有 hidden。
 *
 * 初始：
 * <div id="progressPanel" class="progress-panel" hidden>
 *
 * JS submit 後：
 * progressPanel.hidden = false;
 */

.progress-panel {
	min-height: 520px;
	padding: 60px 20px;
	text-align: center;

	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;

	animation: progressFadeIn 0.35s ease both;
}

@keyframes progressFadeIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.spinner {
	width: 54px;
	height: 54px;
	border: 4px solid #e4e1da;
	border-top-color: #222;
	border-radius: 50%;
	animation: spin 0.9s linear infinite;
}

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

.progress-panel h2 {
	margin: 25px 0 8px;
	font-size: 26px;
}

.progress-panel p {
	color: var(--muted);
	margin: 0 0 28px;
	min-height: 24px;
}

.progress-line {
	width: min(360px, 100%);
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--soft);
}

.progress-line span {
	display: block;
	width: 0;
	height: 100%;
	background: var(--accent);
	border-radius: inherit;
	transition: width 0.7s ease;
}

/* =========================
   Result
========================= */

.result-page {
	width: min(1120px, calc(100% - 32px));
	margin: 0 auto;
	padding: 52px 0 80px;
}

.result-top {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	align-items: end;
	margin-bottom: 28px;
}

.result-top h1 {
	margin: 0;
	font-size: clamp(32px, 4vw, 54px);
}

.result-top p {
	color: var(--muted);
	margin: 8px 0 0;
}

.mockup-frame {
	background: #dcd8cf;
	border-radius: 20px;
	padding: 18px;
	box-shadow: 0 25px 80px rgba(0, 0, 0, 0.12);
}

.mockup-frame img {
	width: 100%;
	display: block;
	border-radius: 10px;
}

.back-link {
	color: var(--ink);
	text-decoration: none;
	font-weight: 700;
}

/* =========================
   Error
========================= */

.error-box {
	padding: 16px;
	border-radius: 12px;
	background: #fff0ee;
	color: #8f2118;
}

/* =========================
   Responsive
========================= */

@media (max-width: 900px) {
	.page-shell {
		grid-template-columns: 1fr;
		gap: 32px;
		padding-top: 36px;
	}

	.hero-copy {
		position: static;
	}

	.form-card {
		padding: 26px;
		border-radius: 22px;
	}

	.progress-panel {
		min-height: 420px;
	}
}

@media (max-width: 640px) {
	.page-shell {
		width: min(100% - 24px, 1180px);
	}

	.grid.two {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.preview-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.form-card {
		padding: 20px;
	}

	.hero-copy h1 {
		font-size: 42px;
	}

	.result-top {
		display: block;
	}

	.back-link {
		display: inline-block;
		margin-top: 16px;
	}

	.progress-panel {
		min-height: 360px;
		padding: 40px 10px;
	}

	.progress-panel h2 {
		font-size: 22px;
	}
}