/* ============================================================
   Lucky Wheel – Frontend Styles
   ============================================================ */

/* ---- Overlay backdrop ---- */
.lw-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .65);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity .35s ease;
}
.lw-overlay.lw-visible {
	opacity: 1;
}

/* ---- Wheel modal ---- */
.lw-modal {
	position: relative;
	background: #fff;
	border-radius: 20px;
	padding: 36px 32px 32px;
	max-width: 520px;
	width: calc(100vw - 24px);
	max-height: calc(100svh - 24px);  /* don't overflow the screen */
	overflow-y: auto;
	box-shadow: 0 24px 80px rgba(0,0,0,.35);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	transform: scale(.85);
	transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.lw-overlay.lw-visible .lw-modal {
	transform: scale(1);
}

.lw-title {
	margin: 0;
	font-size: clamp(1rem, 4vw, 1.4rem);
	font-weight: 700;
	color: #222;
	text-align: center;
}

/* ---- Close button ---- */
.lw-close {
	position: absolute;
	top: 14px;
	right: 18px;
	background: none;
	border: none;
	font-size: 1.8rem;
	line-height: 1;
	color: #888;
	cursor: pointer;
	padding: 0;
	transition: color .2s;
}
.lw-close:hover { color: #222; }

/* ---- Wheel container ---- */
.lw-wheel-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* Pointer triangle pointing downward at the top of the wheel */
.lw-pointer {
	position: absolute;
	top: -14px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 14px solid transparent;
	border-right: 14px solid transparent;
	border-top: 28px solid #e74c3c;
	filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
	z-index: 2;
}

#lw-canvas {
	display: block;
	border-radius: 50%;
	box-shadow: 0 8px 32px rgba(0,0,0,.25);
}

/* ---- Spin button ---- */
.lw-spin-btn {
	background: linear-gradient(135deg, #e74c3c, #c0392b);
	color: #fff;
	font-size: clamp(1rem, 3.5vw, 1.15rem);
	font-weight: 700;
	letter-spacing: .04em;
	padding: 13px 48px;
	width: 100%;
	max-width: 280px;
	border: none;
	border-radius: 50px;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(231,76,60,.45);
	transition: transform .15s, box-shadow .15s, background .2s;
}
.lw-spin-btn:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(231,76,60,.55);
}
.lw-spin-btn:active:not(:disabled) {
	transform: translateY(1px);
}
.lw-spin-btn:disabled {
	opacity: .55;
	cursor: not-allowed;
}

/* ---- Prize overlay ---- */
.lw-prize-overlay { z-index: 9999999; }

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

.lw-prize-modal {
	position: relative;
	background: #fff;
	border-radius: 24px;
	padding: 48px 40px 40px;
	max-width: 440px;
	width: calc(100vw - 32px);
	box-shadow: 0 24px 80px rgba(0,0,0,.4);
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	transform: scale(.8);
	transition: transform .4s cubic-bezier(.34,1.56,.64,1);
	z-index: 9999999;
}
.lw-overlay.lw-visible .lw-prize-modal {
	transform: scale(1);
}

.lw-prize-icon {
	font-size: 4rem;
	line-height: 1;
	animation: lw-bounce .6s ease .2s both;
}

@keyframes lw-bounce {
	0%   { transform: scale(0) rotate(-15deg); }
	60%  { transform: scale(1.2) rotate(5deg); }
	80%  { transform: scale(.95) rotate(-2deg); }
	100% { transform: scale(1) rotate(0); }
}

.lw-prize-heading {
	margin: 0;
	font-size: 2rem;
	font-weight: 800;
	background: linear-gradient(135deg, #e74c3c, #f39c12);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.lw-prize-image-wrap {
	width: 100%;
	max-height: 220px;
	overflow: hidden;
	border-radius: 10px;
}
.lw-prize-image {
	width: 100%;
	height: 100%;
	max-height: 220px;
	object-fit: cover;
	border-radius: 10px;
	display: block;
}

.lw-prize-text {
	margin: 0;
	font-size: 1.2rem;
	color: #333;
	font-weight: 600;
	line-height: 1.5;
}
/* Allow basic HTML inside prize text */
.lw-prize-text a            { color: #e74c3c; }
.lw-prize-text strong, .lw-prize-text b { font-weight: 800; }
.lw-prize-text p            { margin: .4em 0; }

/* ---- Retry button ---- */
.lw-retry-btn {
	background: linear-gradient(135deg, #e74c3c, #c0392b);
	color: #fff;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: .04em;
	padding: 11px 40px;
	border: none;
	border-radius: 50px;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(231,76,60,.4);
	transition: transform .15s, box-shadow .15s;
}
.lw-retry-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(231,76,60,.5);
}
.lw-retry-btn:active { transform: translateY(1px); }

/* ---- Coupon code ---- */
.lw-coupon-wrap {
	width: 100%;
	background: #fff8f0;
	border: 2px dashed #f39c12;
	border-radius: 12px;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.lw-coupon-label {
	margin: 0;
	font-size: .85rem;
	font-weight: 600;
	color: #888;
	text-transform: uppercase;
	letter-spacing: .06em;
}

.lw-coupon-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: center;
}

.lw-coupon-code {
	font-family: 'Courier New', Courier, monospace;
	font-size: 1.45rem;
	font-weight: 700;
	letter-spacing: .12em;
	color: #e74c3c;
	background: #fff;
	border: 1px solid #f0c090;
	border-radius: 6px;
	padding: 4px 12px;
	user-select: all;
}

.lw-copy-btn {
	background: #f39c12;
	color: #fff;
	border: none;
	border-radius: 20px;
	padding: 6px 18px;
	font-size: .85rem;
	font-weight: 700;
	cursor: pointer;
	transition: background .2s, transform .15s;
	flex-shrink: 0;
}
.lw-copy-btn:hover { background: #d68910; transform: translateY(-1px); }
.lw-copy-btn:active { transform: translateY(0); }

.lw-coupon-hint {
	margin: 0;
	font-size: .8rem;
	color: #aaa;
}

/* ---- Responsive ---- */
@media (max-width: 500px) {
	.lw-modal        { padding: 28px 14px 20px; gap: 12px; border-radius: 16px; }
	.lw-prize-modal  { padding: 36px 20px 28px; }
	.lw-prize-icon   { font-size: 3rem; }
	.lw-prize-heading{ font-size: 1.6rem; }
	.lw-prize-text   { font-size: 1.05rem; }
}

/* Very short screens (landscape mobile) */
@media (max-height: 500px) {
	.lw-overlay { align-items: flex-start; padding: 8px 0; }
	.lw-modal   { max-height: calc(100svh - 16px); padding: 24px 16px 16px; gap: 10px; }
	.lw-title   { font-size: .95rem; }
}
