/* Holiday look: deep green, red / green / gold wheel, gold title, red stars.
   One typeface everywhere: self-hosted Lato (OFL), Arial as fallback.
   Colours below are defaults - config.json "colors" overrides them. */
@font-face {
	font-family: "Lato";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/static/lato-regular.woff2") format("woff2");
}
@font-face {
	font-family: "Lato";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("/static/lato-bold.woff2") format("woff2");
}
:root {
	--bg: #0f3d2e;
	--bg2: #08261c;
	--accent: #c8102e;
	--accent2: #1f7a3a;
	--gold: #f2c14e;
	--text: #fffaf0;
	/* wheel size: phones get most of the width but never so tall that the
	   result text is pushed off screen; desktops are capped */
	--wheel: clamp(170px, min(74vw, 38svh), 330px);
}
* { box-sizing: border-box; }
html { min-height: 100%; background-color: var(--bg2); }
body {
	margin: 0;
	min-height: 100vh;
	min-height: 100svh;
	font-family: "Lato", Arial, Helvetica, sans-serif;
	color: var(--text);
	background-color: var(--bg2);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
	padding-bottom: max(12px, env(safe-area-inset-bottom));
	overflow-x: hidden;
	-webkit-text-size-adjust: 100%;
}
/* Background on its own fixed layer instead of background-attachment: fixed
   (which Chrome on Android repaints badly). Sized to the large viewport so
   nothing is left unpainted when the URL bar slides away. */
.sky, .snow {
	position: fixed; left: 0; right: 0; top: 0;
	height: 100vh; height: 100lvh;
	pointer-events: none;
}
.sky {
	z-index: 0;
	background: radial-gradient(ellipse at top, var(--bg) 0%, var(--bg2) 75%);
}
.snow {
	z-index: 0;
	background-image:
		radial-gradient(2px 2px at 20px 30px, #fff8, transparent),
		radial-gradient(2px 2px at 120px 80px, #fff6, transparent),
		radial-gradient(1.5px 1.5px at 60px 150px, #fff7, transparent),
		radial-gradient(2px 2px at 170px 190px, #fff5, transparent),
		radial-gradient(1.5px 1.5px at 90px 220px, #fff6, transparent);
	background-size: 200px 240px;
	animation: snow 18s linear infinite;
}
@keyframes snow { to { background-position: 40px 240px; } }
.card {
	position: relative; z-index: 1;
	width: 100%; max-width: 460px;
	text-align: center;
	padding: clamp(14px, 3.5vw, 24px) clamp(14px, 4vw, 28px);
	border-radius: 18px;
	background: #00000033;
	border: 2px solid var(--gold);
	box-shadow: 0 0 0 6px #ffffff10, 0 12px 40px #0008;
	display: grid;
	grid-template-columns: 100%;
	grid-template-areas: "title" "subtitle" "wheel" "panel" "privacy";
	justify-items: center;
}
h1 {
	grid-area: title;
	font-weight: 700;
	font-size: clamp(1.35rem, 5.6vw, 2.1rem);
	line-height: 1.15;
	letter-spacing: .01em;
	margin: 2px 0 6px;
	color: var(--gold);
	text-shadow: 0 2px 0 #0006;
	text-wrap: balance;
}
h1::before, h1::after { content: "\2605"; color: var(--accent); margin: 0 .3em; font-size: .8em; text-shadow: none; }
.subtitle { grid-area: subtitle; margin: 0 0 clamp(10px, 2.2svh, 16px); font-size: clamp(.95rem, 3.8vw, 1.05rem); opacity: .92; text-wrap: balance; }
.wheel-wrap {
	grid-area: wheel;
	position: relative;
	width: var(--wheel);
	aspect-ratio: 1;
	margin: 6px auto clamp(12px, 2.4svh, 20px);
}
#wheel {
	display: block;
	width: 100%; height: 100%;
	border-radius: 50%;
	box-shadow: 0 0 0 6px var(--gold), 0 0 0 10px var(--accent), 0 10px 30px #000a;
	transform: rotate(0deg);
	will-change: transform;
}
.pointer {
	position: absolute; left: 50%; top: -14px; z-index: 2;
	width: 0; height: 0; transform: translateX(-50%);
	border-left: 16px solid transparent; border-right: 16px solid transparent;
	border-top: 30px solid var(--gold);
	filter: drop-shadow(0 3px 2px #0009);
}
.hub {
	position: absolute; left: 50%; top: 50%; width: 15%; height: 15%;
	transform: translate(-50%, -50%); border-radius: 50%;
	background: radial-gradient(circle at 35% 35%, #fff3c4 0 18%, var(--gold) 30% 100%);
	box-shadow: 0 0 0 4px var(--accent), 0 2px 6px #0008;
}
form, .result { grid-area: panel; width: 100%; }
form { display: grid; gap: 6px; text-align: left; }
label { font-weight: 700; font-size: .95rem; letter-spacing: .05em; text-transform: uppercase; }
input {
	width: 100%; font: inherit; font-size: 16px; /* 16px stops iOS zooming */
	padding: 11px 14px; border-radius: 10px;
	border: 2px solid #ffffff40; background: #fffaf0; color: #1b1b1b;
}
input:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
input[aria-invalid="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.error { min-height: 1.3em; margin: 2px 0 0; color: #ffd0d0; font-weight: 700; }
.error:empty { min-height: 0; margin: 0; }
button {
	margin-top: 6px; font: inherit; font-size: 1.35rem; font-weight: 700; letter-spacing: .12em;
	padding: 13px; border: 0; border-radius: 12px; cursor: pointer;
	color: #fff; background: linear-gradient(180deg, var(--accent), #8f0b21);
	box-shadow: 0 4px 0 #5e0716, 0 8px 18px #0007;
	touch-action: manipulation;
}
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
button:active { transform: translateY(2px); box-shadow: 0 2px 0 #5e0716; }
button:disabled { opacity: .7; cursor: default; }
.result h2 {
	font-weight: 700;
	color: var(--gold); font-size: clamp(1.35rem, 5.6vw, 1.9rem); line-height: 1.2; margin: 2px 0 8px;
	text-shadow: 0 2px 0 #0006;
	text-wrap: balance;
	animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.prize { font-size: 1.1rem; margin: 0 0 8px; }
.already { opacity: .85; font-size: .95rem; margin: 0; }
.privacy { grid-area: privacy; margin: clamp(10px, 2svh, 16px) 0 0; font-size: .82rem; opacity: .8; text-wrap: balance; }
/* Confetti: a fixed layer the size of the large viewport; JS sizes its buffer
   from this box and hides it again when the last piece has fallen out. */
#confetti {
	position: fixed; left: 0; top: 0;
	width: 100%; height: 100vh; height: 100lvh;
	pointer-events: none; z-index: 5;
}
[hidden] { display: none !important; }

/* Wide screens: wheel on the left, form / result on the right. */
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
	:root { --wheel: clamp(260px, min(36vw, 52vh), 400px); }
	.card {
		max-width: 900px;
		grid-template-columns: auto minmax(260px, 1fr);
		grid-template-areas: "title title" "subtitle subtitle" "wheel panel" "privacy privacy";
		column-gap: clamp(28px, 4vw, 56px);
		align-items: center;
		padding: 24px 36px 20px;
	}
	h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
	.result h2 { font-size: clamp(1.7rem, 2.6vw, 2.3rem); }
	.wheel-wrap { margin: 14px 0 6px 10px; }
	.result { text-align: center; }
	.privacy { margin-top: 18px; }
}
@media (prefers-reduced-motion: reduce) {
	.snow { animation: none; }
}
