/**
 * Ruleta de premios — estilos
 *
 * Usa los tokens del tema (--ma-*) para que se sienta parte de la tienda y no
 * un widget pegado. Todos los tamaños en rem para que escalen con la tipografía.
 */

/* ---------------------------------------------------------- botón flotante */
.ma-ruleta__abrir {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 9000;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.15rem;
	border: 0;
	border-radius: 999px;
	background: var(--ma-teal-600, #007a99);
	color: #fff;
	font: 700 0.92rem/1 var(--ma-font-ui, system-ui, sans-serif);
	box-shadow: 0 8px 24px rgba(0, 122, 153, 0.35);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ma-ruleta__abrir:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(0, 122, 153, 0.45);
}

.ma-ruleta__abrir-icono { font-size: 1.15rem; }

/* ------------------------------------------------------------------ fondo */
.ma-ruleta__fondo {
	position: fixed;
	inset: 0;
	z-index: 9001;
	background: rgba(8, 32, 42, 0.55);
	backdrop-filter: blur(3px);
}

/* ------------------------------------------------------------------ modal */
.ma-ruleta__modal {
	position: fixed;
	z-index: 9002;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(28rem, calc(100vw - 2rem));
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
	padding: 1.75rem 1.5rem 1.5rem;
	background: #fff;
	border-radius: var(--ma-r, 1rem);
	box-shadow: 0 24px 64px rgba(8, 32, 42, 0.35);
	text-align: center;
}

.ma-ruleta__cerrar {
	position: absolute;
	top: 0.5rem;
	right: 0.65rem;
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ma-ink-500, #3f5a66);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.ma-ruleta__cerrar:hover { background: var(--ma-mist, #f2f8fa); }

.ma-ruleta__titulo {
	margin: 0 0 0.35rem;
	font: 700 1.5rem/1.15 var(--ma-font-display, system-ui, sans-serif);
	color: var(--ma-ink-900, #0c2230);
	letter-spacing: -0.01em;
}

.ma-ruleta__sub {
	margin: 0 0 1.25rem;
	font-size: 0.9rem;
	line-height: 1.5;
	color: var(--ma-ink-500, #3f5a66);
}

/* ------------------------------------------------------------------ rueda */
.ma-ruleta__rueda-caja {
	position: relative;
	width: min(17rem, 68vw);
	margin: 0 auto 1.1rem;
	aspect-ratio: 1;
}

.ma-ruleta__rueda {
	width: 100%;
	height: 100%;
	will-change: transform;
}

.ma-ruleta__svg { display: block; width: 100%; height: 100%; }

/* aguja arriba */
.ma-ruleta__aguja {
	position: absolute;
	top: -0.45rem;
	left: 50%;
	transform: translateX(-50%);
	z-index: 3;
	width: 0;
	height: 0;
	border-left: 0.6rem solid transparent;
	border-right: 0.6rem solid transparent;
	border-top: 1rem solid var(--ma-teal-600, #007a99);
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

/* el "?" del centro, siempre visible */
.ma-ruleta__centro {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2;
	display: grid;
	place-items: center;
	width: 3.4rem;
	height: 3.4rem;
	border-radius: 50%;
	background: var(--ma-teal-600, #007a99);
	color: #fff;
	font: 700 1.5rem/1 var(--ma-font-display, system-ui, sans-serif);
	box-shadow: 0 4px 12px rgba(0, 122, 153, 0.4);
	pointer-events: none;
}

/* ----------------------------------------------------------------- estado */
.ma-ruleta__estado {
	min-height: 2.6rem;
	margin: 0 0 0.9rem;
	font-size: 0.95rem;
	line-height: 1.45;
	color: var(--ma-ink-800, #17323f);
}

.ma-ruleta__premio {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: 0.6rem 0.8rem;
	border-radius: 0.75rem;
	background: var(--ma-mist, #f2f8fa);
	font-size: 0.9rem;
}

.ma-ruleta__premio img {
	width: 2.5rem;
	height: 2.5rem;
	object-fit: contain;
	border-radius: 0.4rem;
	flex: 0 0 auto;
}

.ma-ruleta__ir {
	display: inline-block;
	margin-top: 0.7rem;
	color: var(--ma-teal-700, #00607a);
	font-weight: 700;
	font-size: 0.9rem;
}

/* ------------------------------------------------------------------ botón */
.ma-ruleta__girar {
	width: 100%;
	min-height: 3rem;
	border: 0;
	border-radius: 999px;
	background: var(--ma-teal-600, #007a99);
	color: #fff;
	font: 700 1rem/1 var(--ma-font-ui, system-ui, sans-serif);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.ma-ruleta__girar:hover:not(:disabled) { background: var(--ma-teal-700, #00607a); }
.ma-ruleta__girar:disabled { opacity: 0.6; cursor: default; }

.ma-ruleta__nota {
	margin: 0.75rem 0 0;
	font-size: 0.78rem;
	line-height: 1.45;
	color: var(--ma-ink-500, #3f5a66);
}

.ma-ruleta__nota a { color: var(--ma-teal-700, #00607a); font-weight: 700; }

/* --------------------------------------------- bloqueo del scroll de fondo */
body.ma-ruleta-abierta { overflow: hidden; }

/* ------------------------------------------------------------------ móvil */
@media (max-width: 30rem) {
	.ma-ruleta__abrir { right: 0.7rem; bottom: 0.7rem; padding: 0.65rem 0.95rem; font-size: 0.85rem; }
	.ma-ruleta__modal { padding: 1.5rem 1.1rem 1.25rem; }
	.ma-ruleta__titulo { font-size: 1.3rem; }
}

/* --------------------------------------------------- respeto por el usuario */
@media (prefers-reduced-motion: reduce) {
	.ma-ruleta__rueda { transition: none !important; }
	.ma-ruleta__abrir { transition: none; }
}


/* ============================================================================
   PREMIO GANADO · ANTES ERA UN RECUADRO GRIS SIN GRACIA
   ========================================================================== */
.ma-ruleta__estado--premio {
	animation: ma-premio-entra 0.55s cubic-bezier(.2,.9,.3,1.4) both;
}

@keyframes ma-premio-entra {
	0%   { opacity: 0; transform: scale(0.82) translateY(8px); }
	60%  { opacity: 1; transform: scale(1.03) translateY(0); }
	100% { opacity: 1; transform: scale(1); }
}

.ma-ruleta__premio {
	display: flex;
	align-items: flex-start;
	gap: 0.85rem;
	padding: 0.95rem 1rem;
	border-radius: 0.9rem;
	background: linear-gradient(135deg, #EAF6FA 0%, #F7FCFD 100%);
	border: 1.5px solid #BFE3EC;
	text-align: left;
}

.ma-ruleta__premio-icono {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	background: var(--ma-teal-600, #007a99);
	font-size: 1.5rem;
	box-shadow: 0 4px 14px rgba(0, 122, 153, 0.35);
	animation: ma-premio-late 1.6s ease-in-out 0.5s 2;
}

@keyframes ma-premio-late {
	0%, 100% { transform: rotate(0) scale(1); }
	25%      { transform: rotate(-9deg) scale(1.08); }
	75%      { transform: rotate(9deg) scale(1.08); }
}

.ma-ruleta__premio-texto { display: block; font-size: 0.88rem; line-height: 1.45; }
.ma-ruleta__premio-texto b { display: block; font-size: 1.02rem; color: var(--ma-ink-900, #0c2230); margin-bottom: 0.15rem; }
.ma-ruleta__premio-texto span { display: block; color: var(--ma-ink-800, #17323f); }
.ma-ruleta__premio-texto small { display: block; margin-top: 0.3rem; font-size: 0.78rem; color: var(--ma-ink-500, #3f5a66); }

.ma-ruleta__ir {
	display: inline-block;
	margin-top: 0.85rem;
	padding: 0.6rem 1.3rem;
	border-radius: 999px;
	background: var(--ma-teal-600, #007a99);
	color: #fff !important;
	font-weight: 700;
	font-size: 0.9rem;
	text-decoration: none;
	transition: background-color 0.15s ease;
}
.ma-ruleta__ir:hover { background: var(--ma-teal-700, #00607a); }

/* ============================================================================
   "UN INTENTO MÁS" · SE VEÍA COMO UN TEXTO SUELTO
   ========================================================================== */
.ma-ruleta__intento {
	display: block;
	padding: 0.85rem 1rem;
	border-radius: 0.9rem;
	background: #FFF6E5;
	border: 1.5px solid #FFD98A;
	color: #6B4A00;
	font-size: 0.9rem;
	line-height: 1.45;
	animation: ma-premio-entra 0.5s cubic-bezier(.2,.9,.3,1.4) both;
}
.ma-ruleta__intento b { color: #4A3300; }

/* ============================================================================
   CONFETI
   ========================================================================== */
.ma-ruleta__confeti {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
	border-radius: inherit;
}

.ma-ruleta__confeti i {
	position: absolute;
	top: -12px;
	width: 7px;
	height: 12px;
	border-radius: 2px;
	opacity: 0;
	animation-name: ma-confeti-cae;
	animation-timing-function: ease-in;
	animation-fill-mode: forwards;
}

@keyframes ma-confeti-cae {
	0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
	100% { opacity: 0; transform: translateY(420px) rotate(540deg); }
}

/* El modal mientras gira: la rueda vibra un poco al empezar */
.ma-ruleta--girando .ma-ruleta__rueda-caja { animation: ma-ruleta-pulso 0.6s ease-in-out; }
@keyframes ma-ruleta-pulso {
	0%, 100% { transform: scale(1); }
	50%      { transform: scale(1.02); }
}

/* La rueda, un poco más vistosa */
.ma-ruleta__rueda-caja::after {
	content: "";
	position: absolute;
	inset: 4%;
	border-radius: 50%;
	box-shadow: 0 10px 30px rgba(2, 146, 183, 0.18);
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.ma-ruleta__confeti { display: none; }
	.ma-ruleta__estado--premio,
	.ma-ruleta__intento,
	.ma-ruleta__premio-icono,
	.ma-ruleta--girando .ma-ruleta__rueda-caja { animation: none; }
}
