:root {
	--bg: #111315;
	--panel: #1b2024;
	--text: #f8fafc;
	--muted: #aab4bd;
	--accent: #39d98a;
	--accent-dark: #17a968;
	--line: rgba(255, 255, 255, 0.16);
	--danger: #ff6b6b;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
	background: var(--bg);
	color: var(--text);
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
	border: 0;
	font: inherit;
	cursor: pointer;
}

.app-shell {
	position: relative;
	min-height: 100svh;
	overflow: hidden;
	background:
		radial-gradient(circle at 50% 0%, rgba(57, 217, 138, 0.18), transparent 34rem),
		linear-gradient(180deg, #15191c 0%, #0d0f11 100%);
}

.screen {
	display: none;
	min-height: 100svh;
	padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.screen.active {
	display: flex;
}

.screen-start,
.screen-result {
	flex-direction: column;
	justify-content: space-between;
	gap: 24px;
}

.brand {
	padding-top: 10svh;
}

.eyebrow {
	margin: 0 0 10px;
	color: var(--accent);
	font-size: 0.78rem;
	font-weight: 800;
	text-transform: uppercase;
}

h1,
h2,
p {
	letter-spacing: 0;
}

h1 {
	margin: 0;
	max-width: 12ch;
	font-size: clamp(2.4rem, 14vw, 4.8rem);
	line-height: 0.96;
}

h2 {
	margin: 0;
	font-size: 1.2rem;
	line-height: 1.25;
}

.intro {
	max-width: 28rem;
	margin: 18px 0 0;
	color: var(--muted);
	font-size: 1rem;
	line-height: 1.55;
}

.notice {
	min-height: 1.5em;
	margin: 0;
	color: var(--muted);
	font-size: 0.9rem;
	text-align: center;
}

.primary-button,
.secondary-button {
	width: 100%;
	min-height: 56px;
	border-radius: 8px;
	font-weight: 800;
}

.primary-button {
	background: var(--accent);
	color: #07100b;
}

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

.secondary-button {
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.08);
	color: var(--text);
}

.screen-camera {
	flex-direction: column;
	gap: 16px;
}

.top-bar {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
}

.camera-stage,
.result-preview {
	position: relative;
	width: 100%;
	max-width: min(100%, 480px);
	margin: 0 auto;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #050607;
}

#cameraVideo,
.frame-overlay,
#resultImage {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#cameraVideo {
	transform: scaleX(-1);
}

.frame-overlay {
	pointer-events: none;
}

.frame-overlay.is-missing {
	display: none;
}

.countdown {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgba(0, 0, 0, 0.2);
	color: white;
	font-size: clamp(5rem, 36vw, 10rem);
	font-weight: 900;
	text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.countdown:empty {
	display: none;
}

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

.frame-button {
	min-height: 44px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.08);
	color: var(--text);
	font-size: 0.86rem;
	font-weight: 700;
}

.frame-button.active {
	border-color: var(--accent);
	background: rgba(57, 217, 138, 0.18);
	color: var(--accent);
}

.actions {
	display: flex;
	justify-content: center;
	padding-top: 4px;
}

.shutter-button {
	width: 76px;
	height: 76px;
	border: 6px solid var(--text);
	border-radius: 999px;
	background: var(--accent);
	box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1);
}

.shutter-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.result-preview {
	margin-top: 8px;
}

.result-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.error-message {
	position: fixed;
	left: 14px;
	right: 14px;
	bottom: max(14px, env(safe-area-inset-bottom));
	z-index: 20;
	padding: 14px 16px;
	border: 1px solid rgba(255, 107, 107, 0.42);
	border-radius: 8px;
	background: rgba(36, 15, 17, 0.96);
	color: #ffe5e5;
	line-height: 1.45;
}

@media (min-width: 560px) {
	.app-shell {
		display: grid;
		place-items: center;
	}

	.screen {
		width: min(100%, 520px);
	}
}
