/* ==========================================================================
   Spin & Win — namespaced styles (spinwin-). Self-contained, no global leakage.
   ========================================================================== */

/* --- Wheel stage --------------------------------------------------------- */

.spinwin { position: relative; }

/* The wheel container is fully transparent — it floats directly on the page
   background — and hugs the header above it. */
.spinwin.section { 
	margin-top: 0;
	background: transparent;
}

/* Specificity (0,2,0) ties the theme's .smm-panel .card and wins on load
   order, so the white card look (background, border, shadow, blur, padding)
   is fully stripped and the wheel floats transparently on the page. */
.spinwin .spinwin-card {
	position: relative;
	background: transparent;
	border: 0;
	box-shadow: none;
	backdrop-filter: none;
	padding: 0;
}

.spinwin-stage {
	position: relative;
	width: min(320px, 100%);
	margin: 0 auto;
	aspect-ratio: 1 / 1;
}

.spinwin-pointer {
	position: absolute;
	top: -8px;
	left: 50%;
	z-index: 4;
	width: 0;
	height: 0;
	border-left: 14px solid transparent;
	border-right: 14px solid transparent;
	border-top: 24px solid #ffffff;
	transform: translateX(-50%);
	filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
}

.spinwin-pointer::after {
	content: "";
	position: absolute;
	top: -31px;
	left: 50%;
	width: 9px;
	height: 9px;
	background: #f59e0b;
	border-radius: 50%;
	transform: translateX(-50%);
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* The slice fill (rendered inline as a conic-gradient) uses 0.1-opacity
   colors, so the wheel face is a faint tint over the page background rather
   than a solid colored wheel. The background color itself stays transparent. */
.spinwin-wheel {
	position: absolute;
	inset: 6px;
	border-radius: 50%;
	background-color: transparent;
	border: 6px solid #ffffff;
	box-shadow:
		0 12px 28px rgba(0, 0, 0, 0.22),
		inset 0 0 0 3px rgba(255, 255, 255, 0.85),
		0 0 0 3px rgba(0, 0, 0, 0.08);
	transition: transform 9.6s cubic-bezier(0.12, 0.74, 0.13, 1);
	will-change: transform;
}

.spinwin-wheel.is-spinning { transition-duration: 10.4s; }

.spinwin-wheel__photos {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	z-index: 1;
}

/* Product photo badge, centered within its own slice. The wrapper rotates the
   positioning axis to the slice bisector; the badge then sits near the rim —
   roughly 75% of the wheel radius along that bisector — and the counter-rotation
   on the image keeps the photo upright instead of tilted with the slice. */
.spinwin-photo {
	position: absolute;
	inset: 0;
	transform: rotate(var(--spinwin-angle));
	pointer-events: none;
}

/* Shared positioning for the circular slice badges (product photos and
   discount amounts) so they stay visually in sync by construction. */
.spinwin-photo img,
.spinwin-discount__badge {
	position: absolute;
	left: 50%;
	top: var(--spinwin-photo-top, 12%);
	width: var(--spinwin-photo-size, 22%);
	height: var(--spinwin-photo-size, 22%);
	border-radius: 50%;
	border: 4px solid #ffffff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.55);
	transform: translate(-50%, -50%) rotate(calc(-1 * var(--spinwin-angle)));
}

.spinwin-photo img { object-fit: cover; }

/* Discount reward badge: mirrors the photo treatment, but the circle carries
   the amount in the theme's display serif. The badge is a size container, so
   the type scales with the badge (cqw) at every wheel size. */
.spinwin-discount__badge {
	container-type: size;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 3px;
	background: #ffffff;
	text-align: center;
	line-height: 1;
}

.spinwin-discount__currency {
	display: block;
	font-family: var(--font-body);
	font-size: 11cqw;
	font-weight: 800;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #7c3aed;
}

.spinwin-discount__amount {
	display: block;
	font-family: var(--font-display, "Baskerville", "Iowan Old Style", "Palatino Linotype", serif);
	font-size: 21cqw;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
	background: linear-gradient(120deg, #7c3aed, #db2777);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	white-space: nowrap;
}

/* Longer amounts (six digits + commas) get a smaller size so they stay
   inside the circle instead of clipping. */
.spinwin-discount__amount.is-long { font-size: 16cqw; }

.spinwin-wheel__hub {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 88px;
	height: 88px;
	margin: -44px 0 0 -44px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.spinwin-spin-button {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 5;
	width: 80px;
	height: 80px;
	margin: -40px 0 0 -40px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	padding: 0 4px;
	font-family: inherit;
	font-weight: 900;
	font-size: 15px;
	line-height: 1.1;
	letter-spacing: 0.1em;
	color: #ffffff;
	background: linear-gradient(145deg, #8b5cf6, #6d28d9 55%, #5b21b6);
	box-shadow: 0 8px 20px rgba(109, 40, 217, 0.45);
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.spinwin-spin-button:hover { transform: scale(1.06); box-shadow: 0 10px 26px rgba(109, 40, 217, 0.55); }
.spinwin-spin-button:active { transform: scale(0.97); }
.spinwin-spin-button:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }

.spinwin-spin-button[disabled] {
	cursor: not-allowed;
	filter: grayscale(0.4) brightness(0.9);
	transform: none;
}

/* Server-side error/status line, hidden unless a spin fails. */
.spinwin-note {
	margin: 12px 0 0;
	text-align: center;
	font-size: 13px;
	color: #b91c1c;
}

.spinwin-note[hidden] { display: none; }

/* --- Locked state (already participated) -------------------------------- */

.spinwin-locked {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-items: center;
	justify-content: center;
	margin-top: 14px;
	padding: 12px 14px;
	border: 1px solid rgba(245, 158, 11, 0.3);
	border-radius: var(--radius-sm, 10px);
	background: rgba(245, 158, 11, 0.06);
	text-align: center;
}

.spinwin-locked[hidden] { display: none; }

.spinwin-locked__icon {
	font-size: 18px;
	line-height: 1.2;
}

.spinwin-locked p { margin: 0; }

.spinwin-locked__title {
	font-size: 14px;
	font-weight: 700;
	color: #92400e;
}

.spinwin-locked__text {
	margin-top: 2px;
	font-size: 12px;
	color: #78350f;
}

/* --- Won prize in place of the wheel (participants) ---------------------- */

.spinwin-stage[hidden] { display: none; }

.spinwin-prize {
	position: relative;
	padding: 30px 24px 26px;
	border: 1px solid var(--border-strong, #e5e7eb);
	border-radius: var(--radius-lg, 16px);
	background: var(--card-strong, #ffffff);
	box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.12));
	text-align: center;
	animation: spinwin-rise 0.45s ease-out both;
}

.spinwin-prize[hidden] { display: none; }

.spinwin-prize__inner { max-width: 440px; margin: 0 auto; }

.spinwin-prize .eyebrow { margin-bottom: 2px; }

.spinwin-prize__image { margin-top: 14px; }

.spinwin-prize__emoji {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 64px;
	line-height: 1;
}

.spinwin-prize__actions { margin-top: 18px; justify-content: center; }

.spinwin-prize__forfeit {
	margin: 12px 0 0;
	font-size: 12.5px;
	color: var(--text-soft, #6b7280);
}

/* --- Celebration / result ------------------------------------------------ */

.spinwin-result {
	position: relative;
	padding: 38px 26px 30px;
	border: 1px solid var(--border-strong, #e5e7eb);
	border-radius: var(--radius-lg, 16px);
	background: var(--card-strong, #ffffff);
	box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.12));
	text-align: center;
	animation: spinwin-rise 0.45s ease-out both;
}

.spinwin-result[hidden] { display: none; }

.spinwin-result__inner { max-width: 440px; margin: 0 auto; }

.spinwin-result__confetti {
	font-size: 30px;
	letter-spacing: 0.4em;
	margin: 0 0 6px;
	animation: spinwin-float 2.4s ease-in-out infinite;
}

.spinwin-result .eyebrow { margin-bottom: 2px; }

.spinwin-result__sub {
	margin: 0;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.3em;
	color: var(--text-soft, #6b7280);
}

.spinwin-result__label {
	margin: 10px 0 4px;
	font-size: clamp(26px, 5vw, 36px);
	line-height: 1.15;
	background: linear-gradient(120deg, #7c3aed, #db2777 60%, #f59e0b);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	word-break: break-word;
}

/* The winning product, front and center, inside a soft gradient ring. */
.spinwin-result__image {
	position: relative;
	width: 176px;
	height: 176px;
	margin: 16px auto 18px;
	padding: 8px;
	border-radius: 50%;
	background: linear-gradient(135deg, #7c3aed, #db2777 55%, #f59e0b);
	box-shadow: 0 12px 30px rgba(109, 40, 217, 0.28);
	animation: spinwin-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.spinwin-result__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	border: 4px solid #ffffff;
}

/* Discount wins mirror the wheel slice badge so the prize always matches. */
.spinwin-result__discount-badge {
	container-type: size;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	width: 100%;
	height: 100%;
	padding: 6px;
	border-radius: 50%;
	background: #ffffff;
	border: 4px solid #ffffff;
	text-align: center;
	line-height: 1;
}

/* "Free product — 100% off" reads as a chip under the prize name. */
.spinwin-result__meta {
	display: inline-block;
	margin: 2px 0 0;
	padding: 7px 16px;
	border-radius: 999px;
	background: rgba(124, 58, 237, 0.08);
	border: 1px solid rgba(124, 58, 237, 0.22);
	color: #6d28d9;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.spinwin-result__note { margin: 14px 0 0; font-size: 13.5px; color: var(--text-soft, #6b7280); text-align: center; }

/* --- Keep or forfeit decision (moved up, the primary choice) ------------- */

.spinwin-result__decision {
	margin-top: 18px;
	padding: 18px 18px 16px;
	border: 1px solid rgba(124, 58, 237, 0.28);
	border-radius: var(--radius-lg, 16px);
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.07), rgba(16, 185, 129, 0.05));
}

/* Shared "X spins remaining" pill for the result card. */
.spinwin-pill {
	display: inline-block;
	margin-bottom: 10px;
	padding: 5px 14px;
	border-radius: 999px;
	background: linear-gradient(120deg, #7c3aed, #db2777);
	color: #ffffff;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.spinwin-again p { margin: 0 0 4px; }

.spinwin-again__title {
	font-size: 15px;
	font-weight: 800;
	color: #4c1d95;
}

.spinwin-again__text {
	font-size: 12.5px;
	color: var(--text-soft, #6b7280);
}

.spinwin-again__actions {
	margin-top: 12px;
}

/* The decision panel flips to a quiet green confirmation once kept. */
.spinwin-result__decision.is-kept {
	border-color: rgba(5, 150, 105, 0.35);
	background: linear-gradient(180deg, rgba(5, 150, 105, 0.08), rgba(16, 185, 129, 0.04));
}

.spinwin-result__decision.is-kept .spinwin-pill {
	background: linear-gradient(120deg, #059669, #10b981);
}

/* The "Keep my prize" button is the hero action: big, rounded, glowing. */
.spinwin-keep {
	padding: 15px 30px;
	font-size: 1rem;
	border-radius: 999px;
	box-shadow: 0 10px 24px rgba(109, 40, 217, 0.35);
}

.spinwin-keep:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 30px rgba(109, 40, 217, 0.45);
}

/* Proceed actions sit below the decision, separated by a quiet rule. They are
   hidden while a spin remains and fade in once the customer keeps the prize. */
.spinwin-result__actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.spinwin-result__actions[hidden] { display: none; }

.spinwin-result__actions.is-revealed {
	animation: spinwin-rise 0.35s ease-out both;
}

/* Added-to-cart confirmation state. */
.spinwin-result .button.is-added {
	background: #059669;
	border-color: #059669;
	box-shadow: none;
}

/* Entrance / accent animations. */
@keyframes spinwin-rise {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes spinwin-pop {
	from { opacity: 0; transform: scale(0.6); }
	to { opacity: 1; transform: scale(1); }
}

@keyframes spinwin-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-5px); }
}

/* --- Minimum checkout notice (only shown on Checkout click) -------------- */

.spinwin-result__min-notice {
	margin-top: 14px;
	padding: 12px 14px;
	border: 1px solid rgba(245, 158, 11, 0.4);
	border-radius: var(--radius-sm, 10px);
	background: rgba(245, 158, 11, 0.07);
	text-align: center;
}

.spinwin-result__min-notice p { margin: 0 0 10px; }

.spinwin-result__min-notice .button-row { margin-bottom: 0; }

.spinwin-result__min-title {
	font-weight: 700;
	color: #92400e;
}

/* --- Confetti canvas ------------------------------------------------------ */

.spinwin-confetti {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 90;
	pointer-events: none;
}

.spinwin-confetti[hidden] { display: none; }

/* --- Popup / modal -------------------------------------------------------- */

.spinwin-modal[hidden] { display: none; }

.spinwin-modal {
	position: fixed;
	inset: 0;
	z-index: 70;
	display: grid;
	place-items: center;
	padding: 20px;
}

.spinwin-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(2, 11, 13, 0.6);
	backdrop-filter: blur(8px);
}

.spinwin-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(440px, 100%);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 18px;
	border: 1px solid var(--border-strong, #e5e7eb);
	border-radius: var(--radius-lg, 16px);
	background: var(--card-strong, #ffffff);
	box-shadow: var(--shadow, 0 20px 60px rgba(0, 0, 0, 0.35));
}

.spinwin-modal__dialog .spinwin { margin: 0; }

.spinwin-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 6;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	color: var(--text-soft, #4b5563);
	background: rgba(0, 0, 0, 0.06);
	transition: background 0.15s ease, transform 0.15s ease;
}

.spinwin-modal__close:hover { background: rgba(0, 0, 0, 0.14); transform: rotate(90deg); }

body.spinwin-lock-scroll { overflow: hidden; }

/* --- Store notice (one-liner) -------------------------------------------- */

.spinwin-notice {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	max-width: 820px;
	margin: 0 auto 4px;
	padding: 10px 18px;
	border: 1px solid rgba(124, 58, 237, 0.22);
	border-radius: 999px;
	background: linear-gradient(90deg, rgba(124, 58, 237, 0.07), rgba(16, 185, 129, 0.05));
	font-size: 14px;
	color: var(--text, #1f2937);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.spinwin-notice__icon {
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}

.spinwin-notice__line {
	margin: 0;
	flex: 0 1 auto;
	min-width: 0;
	text-align: center;
}

.spinwin-notice__line strong { color: #6d28d9; }

.spinwin-notice__muted { color: var(--text-soft, #6b7280); }

.spinwin-notice__cta {
	flex-shrink: 0;
	font-size: 13px;
	font-weight: 700;
	color: #6d28d9;
	text-decoration: none;
	white-space: nowrap;
}

.spinwin-notice__cta:hover { text-decoration: underline; }

.spinwin-notice__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 520px) {
	.spinwin-stage { width: min(340px, 100%); }
	.spinwin-photo img { border-width: 3px; }
	.spinwin-wheel__hub, .spinwin-spin-button { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
	.spinwin-spin-button { font-size: 13px; }
	.spinwin-modal { padding: 14px; }
	.spinwin-notice { border-radius: 14px; flex-wrap: wrap; }
	.spinwin-prize { padding: 24px 16px 20px; }
	.spinwin-prize__actions .button { width: 100%; }
	.spinwin-result { padding: 28px 16px 22px; }
	.spinwin-result__image { width: 152px; height: 152px; }
	.spinwin-again__actions .button,
	.spinwin-result__decision .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.spinwin-wheel { transition: none; }
	.spinwin-confetti { display: none; }
	.spinwin-prize,
	.spinwin-result,
	.spinwin-result__image,
	.spinwin-result__confetti,
	.spinwin-result__actions.is-revealed { animation: none; }
	.spinwin-keep:hover { transform: none; }
}
