.spm-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.6);
	padding: 20px;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.spm-overlay.spm-visible {
	opacity: 1;
}

.spm-overlay[hidden] {
	display: none;
}

.spm-box {
	position: relative;
	background: #111;
	color: #fff;
	border-radius: 10px;
	max-width: 520px;
	width: 100%;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	transform: translateY(16px);
	transition: transform 0.25s ease;
}

.spm-box-inner {
	overflow-y: auto;
	border-radius: inherit;
}

.spm-overlay.spm-visible .spm-box {
	transform: translateY(0);
}

.spm-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: rgba(130, 130, 130, 0.65);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 1;
	padding: 0;
}

.spm-close:hover {
	background: rgba(160, 160, 160, 0.85);
}

.spm-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px 10px 0 0;
}

.spm-body {
	padding: 24px 28px 28px;
	text-align: center;
}

.spm-title {
	margin: 0 0 12px;
	font-size: 1.5em;
	line-height: 1.3;
	color: #fff;
}

.spm-text {
	margin-bottom: 18px;
	color: #fff;
}

.spm-text a {
	color: #9ec5fe;
}

.spm-button {
	display: inline-block;
	padding: 12px 28px;
	background: #fff;
	color: #000 !important;
	border-radius: 6px;
	text-decoration: none !important;
	font-weight: 600;
	transition: background 0.2s ease;
}

.spm-btn-first .spm-button {
	margin-bottom: 18px;
}

.spm-btn-first .spm-text {
	margin-bottom: 0;
}

.spm-button:hover {
	background: #e0e0e0;
	color: #000;
}

@media (max-width: 480px) {
	.spm-body {
		padding: 18px 16px 22px;
	}
}

/* Style "Étroit" : popup plus étroit, croix blanche contrastée. */
.spm-style-compact .spm-close,
.spm-style-sheet .spm-close {
	background: #fff;
	color: #000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.spm-style-compact .spm-close:hover,
.spm-style-sheet .spm-close:hover {
	background: #e0e0e0;
}

@media (max-width: 480px) {
	.spm-style-compact {
		padding: 24px;
	}

	.spm-style-compact .spm-box {
		width: 85%;
		max-height: 80vh;
	}

	.spm-style-compact .spm-title {
		font-size: 1.25em;
	}
}

/* Style "Croix en débord" : croix à cheval sur le coin, hors de l'image. */
.spm-style-corner .spm-close {
	top: -14px;
	right: -14px;
	width: 36px;
	height: 36px;
	background: #111;
	border: 2px solid #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.spm-style-corner .spm-close:hover {
	background: #333;
}

@media (max-width: 480px) {
	.spm-style-corner .spm-box {
		width: 80%;
		max-height: 80vh;
	}
}

/* Style "Bottom sheet" : glisse depuis le bas sur mobile. */
@media (max-width: 480px) {
	.spm-style-sheet {
		align-items: flex-end;
		padding: 0;
	}

	.spm-style-sheet .spm-box {
		max-width: none;
		max-height: 70vh;
		border-radius: 16px 16px 0 0;
		transform: translateY(100%);
		transition: transform 0.3s ease;
	}

	.spm-style-sheet.spm-visible .spm-box {
		transform: translateY(0);
	}

	.spm-style-sheet .spm-image img {
		max-height: 30vh;
		object-fit: cover;
		border-radius: 16px 16px 0 0;
	}

	/* Poignée : indique qu'on peut glisser vers le bas pour fermer. */
	.spm-style-sheet .spm-box::before {
		content: '';
		position: absolute;
		top: 8px;
		left: 50%;
		z-index: 2;
		width: 40px;
		height: 5px;
		margin-left: -20px;
		border-radius: 3px;
		background: rgba(255, 255, 255, 0.9);
		box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
		pointer-events: none;
	}

	.spm-style-sheet .spm-box-inner {
		overscroll-behavior: contain;
	}

	.spm-style-sheet .spm-close {
		top: 12px;
		right: 12px;
		width: 40px;
		height: 40px;
	}
}

/* Flèche "voir la suite" du bottom sheet, visible tant qu'il reste du contenu plus bas. */
.spm-scroll-hint {
	display: none;
}

.spm-style-sheet .spm-box.spm-has-more::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 72px;
	background: linear-gradient(to bottom, rgba(17, 17, 17, 0), #111 85%);
	pointer-events: none;
}

.spm-style-sheet .spm-box.spm-has-more .spm-scroll-hint {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	left: 50%;
	bottom: 14px;
	z-index: 2;
	width: 40px;
	height: 40px;
	margin-left: -20px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
	cursor: pointer;
	animation: spm-bounce 1.6s ease-in-out infinite;
}

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

@media (prefers-reduced-motion: reduce) {
	.spm-scroll-hint {
		animation: none !important;
	}
}

/* Pastille en bas à gauche : rouvre le popup. */
.spm-badges {
	position: fixed;
	left: 20px;
	bottom: calc(20px + env(safe-area-inset-bottom, 0px));
	z-index: 999998;
	display: flex;
	flex-direction: column-reverse;
	gap: 12px;
}

.spm-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 3px solid #fff;
	border-radius: 50%;
	overflow: hidden;
	background: #111;
	color: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
	cursor: pointer;
	transition: transform 0.2s ease;
}

.spm-badge:hover {
	transform: scale(1.06);
}

.spm-badge:focus-visible {
	outline: 3px solid #9ec5fe;
	outline-offset: 2px;
}

.spm-badge img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (max-width: 480px) {
	.spm-badges {
		left: 16px;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}

	.spm-badge {
		width: 56px;
		height: 56px;
	}
}
