/**
 * Quiz & Ads Manager - ad containers, rewarded loader and fallback popup.
 */

/* ---------------------------------------------------------------
   Display ad containers
   --------------------------------------------------------------- */

.adunit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 250px;
	margin: 0 auto 30px;
}

.ad-skeleton {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 300px;
	height: 250px;
	transform: translate(-50%, -50%);
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63%);
	background-size: 400% 100%;
	animation: qam-shimmer 1.4s ease infinite;
}

@keyframes qam-shimmer {
	0% {
		background-position: 100% 0;
	}

	100% {
		background-position: -100% 0;
	}
}

.ad-label {
	display: none;
	margin-bottom: 5px;
	color: #888;
	font-size: 12px;
	text-align: center;
}

.ad-box {
	position: relative;
	z-index: 1;
}

.adnotes {
	margin-top: auto;
	padding-top: 20px;
	color: #6b7280;
	font-size: 12px;
	text-align: center;
}

/* ---------------------------------------------------------------
   Full screen loader shown while the rewarded ad is requested
   --------------------------------------------------------------- */

.qam-loader {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background-color: rgba(255, 255, 255, 0.96);
	transition: opacity 0.5s ease;
}

.qam-loader.is-hiding {
	opacity: 0;
}

.qam-loader-spinner {
	width: 60px;
	height: 60px;
	margin-bottom: 20px;
	border: 8px solid #f3f3f3;
	border-top-color: #72c3c1;
	border-radius: 50%;
	animation: qam-spin 2s linear infinite;
}

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

.qam-loader-text {
	width: 100%;
	margin-bottom: 30px;
	color: #111819;
	font-size: 20px;
	font-weight: bold;
	text-align: center;
}

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

.qam-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 999998;
	display: none;
	box-sizing: border-box;
	align-items: center;
	justify-content: center;
	padding: 16px;
	overflow-y: auto;
	background: rgba(15, 23, 42, 0.62);
	-webkit-backdrop-filter: blur(7px);
	backdrop-filter: blur(7px);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

html.qam-popup-open,
html.qam-popup-open body {
	overflow: hidden;
}

.qam-popup-overlay .qam-popup {
	box-sizing: border-box;
	width: 100%;
	max-width: 520px;
	margin: auto;
	padding: 32px 28px 28px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25), 0 4px 15px rgba(0, 0, 0, 0.08);
	text-align: center;
	animation: qam-popup-in 0.35s ease-out;
}

.qam-popup-overlay .qam-popup * {
	box-sizing: border-box;
}

@keyframes qam-popup-in {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.97);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.qam-popup-overlay .qam-popup-title {
	margin: 0 0 18px;
	padding: 0;
	color: #111827;
	font-size: 24px;
	font-weight: 800;
	line-height: 1.3;
	text-transform: uppercase;
}

.qam-popup-overlay .qam-popup-subtitle {
	margin: 0 0 28px;
	padding: 0;
	color: #1f2937;
	font-size: 18px;
	line-height: 1.45;
}

.qam-popup-overlay .qam-popup-btn {
	display: flex;
	gap: 14px;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 64px;
	margin: 0;
	padding: 12px 20px;
	background: #0a3cff;
	border: 0;
	border-radius: 8px;
	color: #ffffff;
	font-family: inherit;
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 0.3px;
	line-height: 1.2;
	text-transform: uppercase;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.2s ease, transform 0.15s ease;
}

.qam-popup-overlay .qam-popup-btn:hover {
	background: #0830d6;
	transform: translateY(-1px);
}

.qam-popup-overlay .qam-popup-btn:focus-visible {
	outline: 3px solid #93c5fd;
	outline-offset: 2px;
}

.qam-popup-overlay .qam-popup-btn:disabled {
	opacity: 0.85;
	transform: none;
	cursor: default;
}

.qam-popup-overlay .qam-popup-btn-icon {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: #ffffff;
	border-radius: 50%;
}

.qam-popup-overlay .qam-popup-btn-icon svg {
	width: 20px;
	height: 20px;
	margin-left: 3px;
	fill: #0a3cff;
}

.qam-popup-overlay .qam-popup-btn-spinner {
	display: none;
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	border: 3px solid rgba(255, 255, 255, 0.35);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: qam-spin 0.8s linear infinite;
}

.qam-popup-overlay .qam-popup.is-loading .qam-popup-btn-icon {
	display: none;
}

.qam-popup-overlay .qam-popup.is-loading .qam-popup-btn-spinner {
	display: block;
}

.qam-popup-overlay .qam-popup-note {
	margin: 22px 0 0;
	padding: 0;
	color: #6b7280;
	font-size: 16px;
	line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
	.qam-popup-overlay .qam-popup {
		animation: none;
	}
}

@media (max-width: 480px) {
	.qam-popup-overlay {
		/* Leave room for the bottom anchor ad. */
		padding: 12px 12px 96px;
	}

	.qam-popup-overlay .qam-popup {
		padding: 26px 18px 22px;
		border-radius: 14px;
	}

	.qam-popup-overlay .qam-popup-title {
		font-size: 20px;
	}

	.qam-popup-overlay .qam-popup-subtitle {
		margin-bottom: 22px;
		font-size: 16px;
	}

	.qam-popup-overlay .qam-popup-btn {
		gap: 12px;
		min-height: 58px;
		font-size: 17px;
	}

	.qam-popup-overlay .qam-popup-btn-icon {
		width: 38px;
		height: 38px;
	}

	.qam-popup-overlay .qam-popup-note {
		font-size: 14px;
	}
}
