/* ==========================================================================
   Peptavora — scratch-to-reveal popup
   Scoped to .ps-* so it cannot leak into the theme.
   ========================================================================== */

.ps-root {
	--ps-navy: #0e2d5a;
	--ps-ink: #142033;
	--ps-muted: #5e6d7e;
	--ps-line: #e5e7eb;
	--ps-soft: #f4f7fc;
	--ps-warm: #f3eee7;
	--ps-card: #ffffff;
	--ps-gold: #c9a227;
	--ps-radius: 22px;
	--ps-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--ps-shadow: 0 30px 80px -20px rgba(14, 45, 90, 0.45);

	position: fixed;
	inset: 0;
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
	font-size: 16px;
	line-height: 1.45;
	color: var(--ps-ink);
	-webkit-font-smoothing: antialiased;
}

.ps-root[hidden] {
	display: none !important;
}

.ps-root *,
.ps-root *::before,
.ps-root *::after {
	box-sizing: border-box;
}

.ps-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 22, 40, 0.62);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.32s var(--ps-ease);
}

.ps-root.is-open .ps-backdrop {
	opacity: 1;
}

/* ---------- card ---------- */

.ps-card {
	position: relative;
	width: 100%;
	max-width: 430px;
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: var(--ps-card);
	border-radius: var(--ps-radius);
	box-shadow: var(--ps-shadow);
	opacity: 0;
	transform: translateY(18px) scale(0.97);
	transition:
		opacity 0.36s var(--ps-ease),
		transform 0.46s var(--ps-ease);
}

.ps-root.is-open .ps-card {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.ps-card::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 4px;
	background: linear-gradient(90deg, var(--ps-navy), #2f6bb5 55%, var(--ps-gold));
	border-radius: var(--ps-radius) var(--ps-radius) 0 0;
}

.ps-inner {
	padding: 30px 26px 26px;
}

.ps-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ps-muted);
	cursor: pointer;
	transition:
		background 0.2s ease,
		color 0.2s ease,
		transform 0.2s ease;
}

.ps-close svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

.ps-close:hover {
	background: var(--ps-soft);
	color: var(--ps-ink);
}

.ps-close:active {
	transform: scale(0.92);
}

/* ---------- copy ---------- */

.ps-kicker {
	margin: 0 0 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ps-gold);
}

.ps-title {
	margin: 0 0 8px;
	font-size: 25px;
	line-height: 1.18;
	letter-spacing: -0.02em;
	color: var(--ps-ink);
	font-weight: 700;
}

.ps-title span {
	color: var(--ps-navy);
	background: linear-gradient(transparent 62%, rgba(201, 162, 39, 0.28) 62%);
	padding: 0 2px;
}

.ps-sub {
	margin: 0 0 20px;
	font-size: 14.5px;
	color: var(--ps-muted);
}

/* ---------- scratch stage ---------- */

.ps-stage {
	position: relative;
	width: 100%;
	height: 148px;
	margin-bottom: 20px;
	border-radius: 16px;
	overflow: hidden;
	background: var(--ps-soft);
	isolation: isolate;
}

.ps-prize {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	background:
		radial-gradient(circle at 50% 0%, rgba(201, 162, 39, 0.16), transparent 62%),
		linear-gradient(160deg, #f7fbff, var(--ps-soft));
	color: var(--ps-navy);
	text-align: center;
	user-select: none;
}

.ps-prize-amount {
	font-size: 46px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
}

.ps-prize-amount span {
	font-size: 26px;
	margin-left: 2px;
}

.ps-prize-word {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ps-muted);
}

.ps-foil {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	touch-action: pan-y;
	cursor: grab;
	transition: opacity 0.4s var(--ps-ease);
}

.ps-stage.is-scratched .ps-foil {
	opacity: 0;
	pointer-events: none;
}

.ps-stage.is-scratched .ps-prize {
	animation: ps-pop 0.5s var(--ps-ease) both;
}

@keyframes ps-pop {
	0% { transform: scale(0.9); }
	60% { transform: scale(1.04); }
	100% { transform: scale(1); }
}

.ps-foil-fallback {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 16px;
	background: linear-gradient(135deg, #dfe6ef, #c9d3e0);
	transition: opacity 0.3s var(--ps-ease);
}

.ps-foil-fallback[hidden] {
	display: none !important;
}

.ps-skip-wrap {
	margin: -8px 0 18px;
	text-align: center;
}

.ps-skip-wrap[hidden] {
	display: none !important;
}

.ps-skip {
	border: 0;
	background: none;
	padding: 4px;
	font-size: 12.5px;
	color: var(--ps-muted);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.ps-skip:hover {
	color: var(--ps-navy);
}

.ps-reveal {
	padding: 12px 22px;
	border: 0;
	border-radius: 999px;
	background: var(--ps-navy);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition:
		transform 0.2s ease,
		box-shadow 0.2s ease;
}

.ps-reveal:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px -8px rgba(14, 45, 90, 0.7);
}

/* ---------- form ---------- */

.ps-field {
	margin-bottom: 12px;
}

.ps-label {
	display: block;
	margin-bottom: 6px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: var(--ps-muted);
}

.ps-input {
	width: 100%;
	padding: 14px 16px;
	border: 1px solid var(--ps-line);
	border-radius: 12px;
	background: #fff;
	color: var(--ps-ink);
	font-size: 16px;
	transition:
		border-color 0.2s ease,
		box-shadow 0.2s ease;
}

.ps-input::placeholder {
	color: #a9b4c1;
}

.ps-input:focus {
	outline: 0;
	border-color: var(--ps-navy);
	box-shadow: 0 0 0 4px rgba(14, 45, 90, 0.1);
}

.ps-input.is-invalid {
	border-color: #c0392b;
	box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.1);
}

.ps-consent {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0 0 16px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--ps-muted);
	cursor: pointer;
	user-select: none;
}

.ps-check {
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	margin: 1px 0 0;
	accent-color: var(--ps-navy);
	cursor: pointer;
}

.ps-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.ps-submit {
	position: relative;
	width: 100%;
	padding: 15px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--ps-navy);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition:
		transform 0.2s ease,
		box-shadow 0.25s ease,
		background 0.2s ease;
}

.ps-submit:hover:not(:disabled) {
	background: #123a70;
	transform: translateY(-1px);
	box-shadow: 0 12px 26px -12px rgba(14, 45, 90, 0.9);
}

.ps-submit:active:not(:disabled) {
	transform: translateY(0);
}

.ps-submit:disabled {
	opacity: 0.75;
	cursor: progress;
}

.ps-spinner {
	position: absolute;
	top: 50%;
	right: 20px;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.2s ease;
	animation: ps-spin 0.7s linear infinite;
}

.ps-submit.is-busy .ps-spinner {
	opacity: 1;
}

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

.ps-msg {
	margin: 10px 0 0;
	font-size: 13px;
	color: #c0392b;
	min-height: 0;
}

.ps-msg:empty {
	margin: 0;
}

.ps-legal {
	margin: 14px 0 0;
	font-size: 11.5px;
	line-height: 1.55;
	color: #8b97a6;
	text-align: center;
}

.ps-legal a {
	color: var(--ps-muted);
	text-decoration: underline;
}

/* ---------- success ---------- */

.ps-success {
	text-align: center;
	animation: ps-fade-up 0.45s var(--ps-ease) both;
}

.ps-success[hidden] {
	display: none !important;
}

@keyframes ps-fade-up {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

.ps-success-kicker {
	margin: 0 0 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ps-gold);
}

.ps-success-label {
	margin: 0 0 8px;
	font-size: 13px;
	color: var(--ps-muted);
}

.ps-code {
	padding: 16px;
	border: 1px dashed #c9d3e0;
	border-radius: 14px;
	background: var(--ps-soft);
	font-size: 24px;
	font-weight: 700;
	letter-spacing: 0.12em;
	color: var(--ps-navy);
	user-select: all;
}

.ps-copy {
	margin-top: 12px;
	padding: 11px 20px;
	border: 1px solid var(--ps-line);
	border-radius: 999px;
	background: #fff;
	color: var(--ps-ink);
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition:
		background 0.2s ease,
		border-color 0.2s ease,
		transform 0.2s ease;
}

.ps-copy:hover {
	background: var(--ps-soft);
	border-color: #c9d3e0;
}

.ps-copy:active {
	transform: scale(0.97);
}

.ps-copy.is-done {
	background: #e8f5ec;
	border-color: #b7e0c4;
	color: #1e7a45;
}

.ps-success-note {
	margin: 14px 0 18px;
	font-size: 13px;
	line-height: 1.55;
	color: var(--ps-muted);
}

.ps-shop {
	display: block;
	padding: 14px 20px;
	border-radius: 999px;
	background: var(--ps-navy);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	transition:
		background 0.2s ease,
		transform 0.2s ease,
		box-shadow 0.25s ease;
}

.ps-shop:hover {
	background: #123a70;
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 12px 26px -12px rgba(14, 45, 90, 0.9);
}

/* ---------- motion / mobile ---------- */

@media (prefers-reduced-motion: reduce) {
	.ps-root .ps-card,
	.ps-root .ps-backdrop,
	.ps-root .ps-foil,
	.ps-root .ps-success,
	.ps-root .ps-stage.is-scratched .ps-prize {
		transition: none !important;
		animation: none !important;
	}

	.ps-card {
		opacity: 1;
		transform: none;
	}
}

@media (max-width: 480px) {
	.ps-root {
		padding: 0;
		align-items: flex-end;
	}

	.ps-card {
		max-width: none;
		max-height: 92dvh;
		border-radius: 22px 22px 0 0;
		transform: translateY(100%);
	}

	.ps-root.is-open .ps-card {
		transform: translateY(0);
	}

	.ps-inner {
		padding: 26px 20px calc(22px + env(safe-area-inset-bottom, 0px));
	}

	.ps-title {
		font-size: 22px;
	}

	.ps-stage {
		height: 132px;
	}

	.ps-prize-amount {
		font-size: 40px;
	}
}

/* Keep the page from scrolling behind the popup. */
body.ps-locked {
	overflow: hidden !important;
	touch-action: none;
}
