.roaming-chatbot {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 999999;
	width: var(--rc-size, 76px);
	height: var(--rc-size, 76px);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
	will-change: transform;
	outline: none;
}

.roaming-chatbot:focus-visible .roaming-chatbot__body {
	outline: 3px solid var(--rc-accent, #4f46e5);
	outline-offset: 4px;
	border-radius: 50%;
}

.roaming-chatbot__body {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), filter 0.24s ease;
	filter: drop-shadow(0 8px 14px rgba(15, 23, 42, 0.22));
	animation: rc-bob 1.1s ease-in-out infinite;
}

.roaming-chatbot.is-facing-left .roaming-chatbot__body {
	transform: scaleX(-1);
}

.roaming-chatbot:hover .roaming-chatbot__body,
.roaming-chatbot:focus-visible .roaming-chatbot__body {
	transform: scale(1.1);
	filter: drop-shadow(0 12px 22px rgba(79, 70, 229, 0.35));
	animation-play-state: paused;
}

.roaming-chatbot.is-facing-left:hover .roaming-chatbot__body,
.roaming-chatbot.is-facing-left:focus-visible .roaming-chatbot__body {
	transform: scaleX(-1) scale(1.1);
}

.roaming-chatbot.is-paused .roaming-chatbot__body {
	animation-play-state: paused;
}

.roaming-chatbot__svg,
.roaming-chatbot__custom-img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	pointer-events: none;
}

.roaming-chatbot__custom-img {
	border-radius: 16px;
}

.roaming-chatbot__shadow {
	position: absolute;
	bottom: -6px;
	left: 50%;
	width: 62%;
	height: 10px;
	transform: translateX(-50%);
	background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.28) 0%, rgba(15, 23, 42, 0) 72%);
	border-radius: 50%;
	pointer-events: none;
	animation: rc-shadow-pulse 1.1s ease-in-out infinite;
}

.roaming-chatbot.is-paused .roaming-chatbot__shadow {
	animation-play-state: paused;
}

/* Speech bubble / tooltip - always visible alongside the mascot */
.roaming-chatbot__bubble {
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%) translateY(0) scale(1);
	background: #0f172a;
	color: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
	padding: 6px 11px;
	border-radius: 999px;
	border: 1.5px solid var(--rc-accent, #4f46e5);
	box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
	opacity: 1;
	pointer-events: none;
	transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease;
}

.roaming-chatbot__bubble::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-width: 5px;
	border-style: solid;
	border-color: var(--rc-accent, #4f46e5) transparent transparent transparent;
}

.roaming-chatbot:hover .roaming-chatbot__bubble,
.roaming-chatbot:focus-visible .roaming-chatbot__bubble {
	background: var(--rc-accent, #4f46e5);
	transform: translateX(-50%) translateY(-2px) scale(1.05);
}

/* Keep bubble inside viewport edges */
.roaming-chatbot.is-bubble-below .roaming-chatbot__bubble {
	bottom: auto;
	top: calc(100% + 10px);
}

.roaming-chatbot.is-bubble-below .roaming-chatbot__bubble::after {
	top: auto;
	bottom: 100%;
	border-color: transparent transparent var(--rc-accent, #4f46e5) transparent;
}

.roaming-chatbot.is-bubble-align-left .roaming-chatbot__bubble {
	left: 0;
	transform: translateX(0) translateY(0) scale(1);
}

.roaming-chatbot.is-bubble-align-left:hover .roaming-chatbot__bubble,
.roaming-chatbot.is-bubble-align-left:focus-visible .roaming-chatbot__bubble {
	transform: translateX(0) translateY(-2px) scale(1.05);
}

.roaming-chatbot.is-bubble-align-left .roaming-chatbot__bubble::after {
	left: 20px;
}

.roaming-chatbot.is-bubble-align-right .roaming-chatbot__bubble {
	left: auto;
	right: 0;
	transform: translateX(0) translateY(0) scale(1);
}

.roaming-chatbot.is-bubble-align-right:hover .roaming-chatbot__bubble,
.roaming-chatbot.is-bubble-align-right:focus-visible .roaming-chatbot__bubble {
	transform: translateX(0) translateY(-2px) scale(1.05);
}

.roaming-chatbot.is-bubble-align-right .roaming-chatbot__bubble::after {
	left: auto;
	right: 20px;
	transform: none;
}

/* SVG character animations */
.roaming-chatbot__svg .rc-eyes {
	transform-box: fill-box;
	transform-origin: center;
	animation: rc-blink 4.5s infinite;
}

.roaming-chatbot.is-walking .roaming-chatbot__svg .rc-foot-left {
	transform-box: fill-box;
	transform-origin: top center;
	animation: rc-step 0.42s ease-in-out infinite alternate;
}

.roaming-chatbot.is-walking .roaming-chatbot__svg .rc-foot-right {
	transform-box: fill-box;
	transform-origin: top center;
	animation: rc-step 0.42s ease-in-out infinite alternate-reverse;
}

.roaming-chatbot.is-walking .roaming-chatbot__svg .rc-arm-left {
	transform-box: fill-box;
	transform-origin: top center;
	animation: rc-arm-swing 0.42s ease-in-out infinite alternate-reverse;
}

.roaming-chatbot.is-walking .roaming-chatbot__svg .rc-arm-right {
	transform-box: fill-box;
	transform-origin: top center;
	animation: rc-arm-swing 0.42s ease-in-out infinite alternate;
}

@keyframes rc-bob {
	0%, 100% {
		margin-top: 0;
	}
	50% {
		margin-top: -5px;
	}
}

@keyframes rc-shadow-pulse {
	0%, 100% {
		transform: translateX(-50%) scaleX(1);
		opacity: 0.7;
	}
	50% {
		transform: translateX(-50%) scaleX(0.84);
		opacity: 0.42;
	}
}

@keyframes rc-blink {
	0%, 92%, 100% {
		transform: scaleY(1);
	}
	95% {
		transform: scaleY(0.1);
	}
}

@keyframes rc-step {
	0% {
		transform: translateY(0) rotate(-6deg);
	}
	100% {
		transform: translateY(-3px) rotate(6deg);
	}
}

@keyframes rc-arm-swing {
	0% {
		transform: rotate(-10deg);
	}
	100% {
		transform: rotate(10deg);
	}
}

@media (max-width: 767px) {
	.roaming-chatbot--hide-mobile {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.roaming-chatbot__body,
	.roaming-chatbot__shadow,
	.roaming-chatbot__svg * {
		animation: none !important;
	}
}
