/* Offer Spin Wheel – mobile-first styles. */

.osw-root {
	--osw-accent: #e65100;
	--osw-accent-text: #fff;
	--osw-text: #1d1d1d;
	--osw-muted: #555;
	--osw-bg: #fff;
	--osw-radius: 16px;
	font-family: inherit;
	color: var(--osw-text);
	line-height: 1.5;
}

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

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

.osw-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.osw-root .osw-is-off {
	display: none !important;
}

.osw-admin-note {
	padding: 12px 16px;
	border: 1px solid #f0c36d;
	border-radius: 6px;
	background: #fff8e5;
	color: #3c2f00;
	font-size: 14px;
	text-align: left;
}

.osw-root--popup .osw-admin-note {
	position: fixed;
	bottom: 16px;
	left: 16px;
	right: 16px;
	z-index: 999998;
	max-width: 520px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ---------- panel ---------- */

.osw-panel {
	text-align: center;
}

.osw-title {
	margin: 0 0 4px;
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--osw-text);
}

.osw-subtitle {
	margin: 0 0 12px;
	font-size: 0.95rem;
	color: var(--osw-muted);
}

.osw-stage {
	position: relative;
	width: min(78vw, 340px);
	max-width: 100%;
	aspect-ratio: 1 / 1;
	margin: 18px auto 16px;
}

/*
 * The wheel element is a square; while rotating, its corners reach ~41% further out
 * and made the dialog's scrollbar flicker. The round, non-rotating clip keeps the
 * layout box fixed, so nothing outside ever changes size during a spin.
 */
.osw-wheel-clip {
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 50%;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
	isolation: isolate;
	-webkit-mask-image: -webkit-radial-gradient(white, black); /* Safari: clip rotated children to the radius. */
}

.osw-wheel {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	will-change: transform;
	backface-visibility: hidden;
}

.osw-svg {
	display: block;
	width: 100%;
	height: 100%;
}

.osw-svg__rim { fill: #fff; stroke: rgba(0, 0, 0, 0.08); stroke-width: 2; }
.osw-svg__seg { stroke: #fff; stroke-width: 2; }
.osw-svg__label { font-family: inherit; font-weight: 700; paint-order: stroke; stroke: rgba(0, 0, 0, 0.12); stroke-width: 1px; }
.osw-svg__label--on-image { stroke: rgba(0, 0, 0, 0.6); stroke-width: 3px; stroke-linejoin: round; }
.osw-svg__hub { fill: #fff; stroke: rgba(0, 0, 0, 0.1); stroke-width: 2; }
.osw-svg__hub-dot { fill: var(--osw-accent); }

/* Pointer at the top, pointing down into the wheel. */
.osw-pointer {
	position: absolute;
	top: -14px;
	left: 50%;
	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(--osw-accent);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.osw-spin-btn,
.osw-action {
	display: inline-block;
	min-width: 200px;
	min-height: 48px;
	padding: 12px 28px;
	border: 0;
	border-radius: 999px;
	background: var(--osw-accent);
	color: var(--osw-accent-text);
	font: inherit;
	font-size: 1.1rem;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(230, 81, 0, 0.35);
}

.osw-spin-btn:disabled {
	opacity: 0.65;
	cursor: wait;
}

.osw-spin-btn:focus-visible,
.osw-action:focus-visible,
.osw-copy:focus-visible,
.osw-close:focus-visible,
.osw-fab:focus-visible {
	outline: 3px solid #1565c0;
	outline-offset: 3px;
}

.osw-error {
	margin: 12px 0 0;
	color: #b71c1c;
	font-weight: 600;
}

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

.osw-result {
	margin-top: 4px;
	outline: none;
}

.osw-result__note {
	margin: 0 0 6px;
	color: var(--osw-muted);
	font-size: 0.95rem;
}

.osw-result__msg {
	margin: 0 0 12px;
	font-size: 1.15rem;
	font-weight: 700;
}

.osw-code {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin: 0 0 12px;
}

.osw-code__value {
	padding: 8px 14px;
	border: 2px dashed var(--osw-accent);
	border-radius: 8px;
	background: #fff8f1;
	font-size: 1.1rem;
	font-weight: 700;
	letter-spacing: 1px;
	color: var(--osw-text);
}

.osw-copy {
	min-height: 40px;
	padding: 6px 14px;
	border: 1px solid var(--osw-accent);
	border-radius: 8px;
	background: transparent;
	color: var(--osw-accent);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.osw-validity {
	margin: 0 0 14px;
	color: var(--osw-muted);
	font-size: 0.9rem;
}

/* Once there is a result, keep the wheel smaller so the message fits on phones. */
.osw-has-result .osw-stage {
	width: min(48vw, 200px);
	margin-top: 14px;
}

/* ---------- inline ---------- */

.osw-root--inline {
	max-width: 480px;
	margin: 24px auto;
	padding: 20px 16px;
	border-radius: var(--osw-radius);
	background: var(--osw-bg);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ---------- popup ---------- */

html.osw-locked,
html.osw-locked body {
	overflow: hidden;
}

.osw-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: rgba(0, 0, 0, 0.6);
	animation: osw-fade 0.2s ease-out;
}

.osw-dialog {
	position: relative;
	width: 100%;
	max-height: 94vh;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 28px 16px 24px;
	border-radius: var(--osw-radius) var(--osw-radius) 0 0;
	background: var(--osw-bg);
	outline: none;
	animation: osw-slide-up 0.25s ease-out;
}

.osw-close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.06);
	box-shadow: none;
	color: var(--osw-text);
	font: inherit;
	font-size: 28px;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
}

.osw-close span { display: block; line-height: 1; transform: translateY(-1px); }

.osw-fab {
	position: fixed;
	bottom: 16px;
	z-index: 999998;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	padding: 10px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--osw-accent);
	color: var(--osw-accent-text);
	font: inherit;
	font-weight: 700;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	animation: osw-pulse 2.4s ease-in-out infinite;
}

.osw-fab--right { right: 16px; }
.osw-fab--left { left: 16px; }
.osw-fab__icon { font-size: 1.3rem; line-height: 1; }

@media (min-width: 600px) {
	.osw-overlay {
		align-items: center;
		padding: 16px;
	}

	.osw-dialog {
		max-width: 440px;
		border-radius: var(--osw-radius);
		padding: 32px 24px 28px;
		animation-name: osw-pop;
	}

	.osw-title { font-size: 1.6rem; }
}

@keyframes osw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes osw-slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes osw-pop { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes osw-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

@media (prefers-reduced-motion: reduce) {
	.osw-overlay,
	.osw-dialog,
	.osw-fab {
		animation: none;
	}

	.osw-wheel {
		transition: none !important;
	}
}
