#ep-bpm {
	display: none;
}

@media (max-width: 767px) {
	#ep-bpm {
		position: fixed;
		inset: auto 0 0;
		z-index: 900;
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 2px max(14px, env(safe-area-inset-right)) calc(2px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
		background: #fff;
		color: #222;
		border-top: 1px solid #e7e3df;
		box-shadow: 0 -3px 16px #00000012;
		box-sizing: border-box;
		transform: translateY(calc(100% + 18px));
		visibility: hidden;
		pointer-events: none;
		transition: transform 320ms ease-in-out, visibility 0s linear 320ms;
	}

	#ep-bpm.ep-bpm-visible {
		transform: translateY(0);
		visibility: visible;
		pointer-events: auto;
		transition-duration: 220ms, 0s;
		transition-delay: 0s;
	}

	/* The full consent dialog takes priority over the shopping bar. */
	body:has(.cmplz-cookiebanner.cmplz-show:not(.cmplz-dismissed)) #ep-bpm {
		display: none;
	}

	/* Lift the two floating controls by the rendered bar height. */
	body:has(#ep-bpm.ep-bpm-widgets-up):not(:has(.cmplz-cookiebanner.cmplz-show:not(.cmplz-dismissed)))
		:is(.joinchat, #cmplz-manage-consent .cmplz-manage-consent) {
		translate: 0 calc(-1 * (var(--ep-bpm-height, 87px) + 20px)) !important;
	}

	/* Restyle the existing Complianz control, retaining its label and click handler. */
	#cmplz-manage-consent button.cmplz-manage-consent.cmplz-show {
		bottom: max(12px, env(safe-area-inset-bottom)) !important;
		right: max(14px, env(safe-area-inset-right)) !important;
		left: auto !important;
		width: 44px;
		min-width: 44px;
		height: 44px;
		min-height: 44px;
		padding: 0 !important;
		box-sizing: border-box;
		border: 1px solid #ddd;
		border-radius: 50%;
		background: #fff;
		color: #333;
		box-shadow: 0 2px 9px #0002;
		font-size: 0 !important;
	}

	#cmplz-manage-consent button.cmplz-manage-consent.cmplz-show::before {
		content: "";
		display: block;
		width: 18px;
		height: 18px;
		margin: auto;
		background: currentColor;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='5' y='10' width='14' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 1 1 8 0v3m-4 5v2'/%3E%3C/svg%3E") center / contain no-repeat;
	}

	#ep-bpm [hidden] {
		display: none;
	}

	#ep-bpm .ep-bpm-image {
		flex: 0 0 82px;
		overflow: hidden;
		padding: 0;
		border: 0;
		background: #fff;
		cursor: pointer;
	}

	#ep-bpm .ep-bpm-image img {
		display: block;
		width: 82px;
		height: 82px;
		object-fit: contain;
		transform: scale(1.34);
	}

	#ep-bpm .ep-bpm-price {
		flex: 1;
		min-width: 0;
		font-size: clamp(17px, 5.4vw, 22px);
		font-weight: 600;
		line-height: 1.2;
	}

	#ep-bpm .ep-bpm-action {
		flex: 0 0 auto;
		min-height: 54px;
		padding: 7px 15px;
		border: 1px solid #222;
		border-radius: 2px;
		background: #222;
		color: #fff;
		font: inherit;
		font-size: 17px;
		font-weight: 600;
		cursor: pointer;
	}
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
	#ep-bpm {
		transition: none;
	}
}
