/* Base colors kept from original */
:root {
	--bg: rgb(252, 221, 227);
	--fg: rgb(235, 37, 136);
	--fg-dark: #b31d7b;
	--white: #fff;
	--shadow: 0 10px 25px rgba(235, 37, 136, 0.15);
	--radius: 14px;
}

body {
	/* Keep palette but add subtle radial highlights to better fill wide screens */
	background:
		radial-gradient(1200px 400px at 10% -10%, rgba(255,255,255,0.38), transparent 60%),
		radial-gradient(800px 320px at 90% 110%, rgba(255,255,255,0.35), transparent 60%),
		var(--bg);
	color: var(--fg);
	font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
	display: flex;
	flex-direction: column; /* stack hero and card vertically */
	align-items: center;
	justify-content: center; /* center group in viewport */
	gap: clamp(12px, 3vh, 24px);
	text-align: center;
	margin: 0;
	min-height: 100svh;
	padding: clamp(16px, 3.5vw, 40px);
}

/* Headings section above the card */
.hero {
	width: min(720px, 92vw);
	text-align: center;
	margin: 0 auto clamp(10px, 3vh, 24px);
}

.sparkles {
	display: inline-block;
	margin-top: 6px;
	font-size: 1.25rem;
	animation: floaty 3s ease-in-out infinite;
}

@keyframes floaty {
	0%, 100% { transform: translateY(0); opacity: 1; }
	50% { transform: translateY(-6px); opacity: .9; }
}

.container {
	/* Make the card a bit wider while staying comfy on mobile */
	width: min(720px, 92vw);
	/* Fit content; we will center it vertically via margins */
	min-height: auto;
	display: flex;
	flex-direction: column;
    align-items: center;
	justify-content: center;
	padding: clamp(16px, 3.2vw, 28px);
	margin-top: 0;
	margin-bottom: 0;
	border-radius: var(--radius);
	/* Consider removing the background entirely; for now, lighten it heavily */
	background:
		radial-gradient(800px 300px at 0% 0%, rgba(255,255,255,0.18), transparent 60%),
		linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.08)),
		rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	border: 1px solid rgba(235, 37, 136, 0.10);
	box-shadow: var(--shadow), 0 2px 0 rgba(255,255,255,0.4) inset;
}

.helper {
	margin: 0 0 10px;
	font-size: 0.95rem;
	color: rgba(235, 37, 136, 0.9);
}

/* Decorative ambient blobs */
.decor {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: -1;
}
.decor span {
	position: absolute;
	width: 240px;
	height: 240px;
	border-radius: 50%;
	filter: blur(50px);
	opacity: 0.25;
	background: radial-gradient(circle at 30% 30%, var(--fg), transparent 70%);
	animation: drift 14s ease-in-out infinite alternate;
}
.decor span:nth-child(1) { left: 10%; top: 10%; animation-delay: 0s; }
.decor span:nth-child(2) { right: 12%; top: 20%; animation-delay: 2s; }
.decor span:nth-child(3) { left: 20%; bottom: 12%; animation-delay: 4s; }
.decor span:nth-child(4) { right: 18%; bottom: 16%; animation-delay: 6s; }
.decor span:nth-child(5) { left: 45%; top: 50%; animation-delay: 8s; }

@keyframes drift {
	0% { transform: translate(0, 0) scale(1); }
	100% { transform: translate(20px, -24px) scale(1.06); }
}

h1 {
	margin: 0 0 10px;
	/* Fluid type that scales with viewport */
	font-size: clamp(2.75rem, 7vw, 4.25rem);
	line-height: 1.15;
	letter-spacing: 0.2px;
	background: linear-gradient(135deg, var(--fg), var(--fg-dark));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

h3 {
	margin: 0 0 24px;
	font-weight: 400;
	opacity: 0.95;
	font-size: clamp(1.25rem, 3vw, 1.75rem);
	/* Keep text measure comfortable on wide screens */
	max-width: 60ch;
	margin-left: auto;
	margin-right: auto;
}

.controls {
	display: flex;
	gap: clamp(10px, 2vw, 14px);
	justify-content: center;
	align-items: center;
	flex-wrap: nowrap;
	flex-direction: column; /* stack input and button vertically */
	width: 100%;
}

input[type="text"] {
	appearance: none;
	border: 2px solid rgba(235, 37, 136, 0.3);
	background: var(--white);
	color: var(--fg);
	border-radius: 12px;
	padding: 18px 20px;
	font-size: clamp(1.05rem, 2vw, 1.25rem);
	/* Let it be nice and wide but not too wide */
	flex: none;
	width: min(100%, 820px);
	outline: none;
	transition: border-color .2s ease, box-shadow .2s ease, transform .06s ease;
	box-shadow: 0 1px 0 rgba(0,0,0,.02);
}

input[type="text"]::placeholder {
	color: rgba(235, 37, 136, 0.7);
}

input[type="text"]:focus {
	border-color: var(--fg);
	box-shadow: 0 0 0 4px rgba(235, 37, 136, 0.18);
}

button#cta {
	appearance: none;
	border: none;
	color: var(--white);
	background: linear-gradient(135deg, var(--fg), var(--fg-dark));
	padding: 18px 24px;
	border-radius: 12px;
	font-weight: 600;
	letter-spacing: .2px;
	font-size: clamp(1.05rem, 1.9vw, 1.25rem);
	cursor: pointer;
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	box-shadow: 0 6px 14px rgba(235, 37, 136, 0.35);
	flex: 0 0 auto;
}

button#cta:hover {
	filter: brightness(1.05);
}

button#cta:active {
	transform: translateY(1px) scale(0.995);
}

/* Disabled button state for reserved names */
button#cta[disabled],
button#cta[aria-disabled="true"] {
	background: linear-gradient(135deg, #ff6b6b, #e34646);
	cursor: not-allowed;
	filter: none;
	box-shadow: 0 6px 14px rgba(227, 70, 70, 0.35);
	opacity: 0.95;
}

/* Modal */
.modal {
	position: fixed;
	inset: 0;
	display: none;
}

.modal.show {
	display: block;
}

.modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.2);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	z-index: 0;
}

.modal-content {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%) scale(0.96);
	background: var(--white);
	color: var(--fg);
	border-radius: 16px;
	padding: clamp(18px, 2vw, 26px);
	width: min(520px, 92vw);
	box-shadow: var(--shadow);
	animation: pop .18s ease-out forwards;
}

.modal-content.error {
	border: 2px solid rgba(235, 37, 136, 0.4);
	box-shadow: 0 10px 25px rgba(235, 37, 136, 0.25);
}

@keyframes pop {
	to { transform: translate(-50%, -50%) scale(1); }
}

.modal-close {
	position: absolute;
	right: 10px;
	top: 8px;
	border: none;
	background: transparent;
	color: var(--fg);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.modal-sub {
	margin: 8px 0 0;
	opacity: .9;
}

/* Confetti layer behind modal */
.confetti-layer {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 1; /* between backdrop and content */
}

.confetti-layer.active {
	pointer-events: none;
}

.modal-content {
	z-index: 2;
}

/* Responsive stacking on small screens */
@media (max-width: 520px) {
	.controls { flex-direction: column; align-items: stretch; gap: 12px; }
	input[type="text"], button#cta { width: 100%; }
	.container { min-height: auto; padding: 16px; }
	h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); }
	h3 { font-size: clamp(0.95rem, 3.8vw, 1.1rem); }
	.hero { margin-bottom: clamp(6px, 2vh, 12px); }
}

/* Ensure centered composition on larger screens */
@media (min-width: 768px) {
	.container { justify-content: center; }
}

/* Extra small screens */
@media (max-width: 360px) {
	h1 { font-size: 1.9rem; }
	h3 { font-size: 1rem; }
}

/* Give a bit more presence on very wide screens */
@media (min-width: 1280px) {
	.container { width: min(1200px, 90vw); }
}

/* Loader overlay */
.loader {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.35);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 20; /* above content, below modal content when shown later */
}

.loader.show { display: flex; }

.loader-content {
	width: min(560px, 92vw);
	background: #fff;
	color: var(--fg);
	border-radius: 14px;
	box-shadow: var(--shadow);
	padding: 20px 24px;
	text-align: left;
}

.loader-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.loader-label {
	font-weight: 600;
	margin-bottom: 10px;
}

.loader-percent {
	font-variant-numeric: tabular-nums;
	opacity: 0.9;
}

.loader-bar {
	position: relative;
	width: 100%;
	height: 12px;
	border-radius: 999px;
	background: rgba(235, 37, 136, 0.15);
	overflow: hidden;
}

.loader-progress {
	height: 100%;
	width: 0%;
	background: linear-gradient(135deg, var(--fg), var(--fg-dark));
	border-radius: inherit;
	transition: width .2s ease;
}

/* Make controls fill available space nicely on very small phones */
@media (max-width: 420px) {
	.controls { width: 100%; }
	input[type="text"] { width: 100%; }
	button#cta { width: 100%; }
}
