.rlww {
	--rlww-primary: #25d366;
	--rlww-body: #ece5dd;
	--rlww-bottom: 28px;
	--rlww-side: 28px;
	--rlww-safe-left: env(safe-area-inset-left, 0px);
	--rlww-safe-right: env(safe-area-inset-right, 0px);
	position: fixed !important;
	bottom: var(--rlww-bottom);
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	line-height: 1.4;
	width: 64px;
	height: 64px;
	max-width: 64px;
}

.rlww--right {
	right: var(--rlww-side);
}

.rlww--left {
	left: var(--rlww-side);
}

.rlww *,
.rlww *::before,
.rlww *::after {
	box-sizing: border-box;
}

.rlww__bubble {
	position: relative;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--rlww-primary);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.24);
	transition: transform 0.2s ease;
	appearance: none;
}

@media (hover: hover) and (pointer: fine) {
	.rlww__bubble:hover {
		transform: scale(1.08) rotate(-4deg);
	}
}

.rlww__bubble svg,
.rlww__send svg {
	display: block;
	fill: currentColor;
}

.rlww__status-dot {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 13px;
	height: 13px;
	background: var(--rlww-primary);
	border: 2px solid #fff;
	border-radius: 50%;
	animation: rlww-pulse 1.8s infinite;
}

@keyframes rlww-pulse {
	0%,
	100% {
		transform: scale(1);
		opacity: 1;
	}

	50% {
		transform: scale(1.4);
		opacity: 0.6;
	}
}

.rlww__panel {
	position: absolute;
	bottom: 76px;
	width: 360px;
	max-width: min(92vw, 360px);
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - var(--rlww-bottom) - 108px);
	max-height: calc(100dvh - var(--rlww-bottom) - 108px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transform: scale(0.85) translateY(12px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition:
		transform 0.22s ease,
		opacity 0.22s ease,
		visibility 0.22s ease;
}

.rlww--right .rlww__panel {
	right: 0;
	transform-origin: bottom right;
}

.rlww--left .rlww__panel {
	left: 0;
	transform-origin: bottom left;
}

.rlww__panel.is-open {
	transform: scale(1) translateY(0);
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.rlww__header {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 0;
	padding: 16px 18px;
	background: var(--rlww-primary);
}

.rlww__header-info {
	flex: 1;
	min-width: 0;
	max-width: 100%;
}

.rlww__header-info strong {
	display: block;
	color: #fff;
	font-size: 1rem;
	line-height: 1.25;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rlww__header-info span {
	display: block;
	color: rgba(255, 255, 255, 0.9);
	margin-top: 3px;
	font-size: 0.78rem;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rlww__close {
	padding: 4px;
	border: 0;
	background: transparent;
	color: rgba(255, 255, 255, 0.82);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

.rlww__body {
	flex: 0 1 auto;
	min-height: 0;
	padding: 16px;
	background: var(--rlww-body);
	overflow: visible;
}

.rlww__message {
	min-width: 0;
	max-width: 100%;
	padding: 12px 14px;
	border-radius: 0 12px 12px 12px;
	background: #fff;
	color: #333;
	font-size: 0.82rem;
	line-height: 1.5;
	white-space: normal !important;
	overflow-wrap: anywhere;
	word-break: normal;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rlww__footer {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 8px;
	padding: 12px 14px;
	background: #f0f0f0;
	border-top: 1px solid #ddd;
}

.rlww__input {
	flex: 1;
	min-width: 0;
	padding: 9px 14px;
	border: 0;
	border-radius: 20px;
	background: #fff;
	color: #333;
	font: inherit;
	font-size: 0.85rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rlww__send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--rlww-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	flex-shrink: 0;
	transition:
		filter 0.15s ease,
		transform 0.15s ease;
}

.rlww__send:hover {
	color: #fff;
	filter: brightness(0.88);
	transform: scale(1.04);
}

.rlww__bubble:focus-visible,
.rlww__close:focus-visible,
.rlww__input:focus-visible,
.rlww__send:focus-visible {
	outline: 3px solid rgba(0, 0, 0, 0.35);
	outline-offset: 3px;
}

@media (max-width: 767px) {
	.rlww {
		position: fixed !important;
		width: 64px !important;
		height: 64px !important;
		max-width: 64px !important;
		min-width: 64px !important;
		overflow: visible;
		bottom: max(
			var(--rlww-bottom, 20px),
			calc(env(safe-area-inset-bottom, 0px) + 16px)
		);
	}

	.rlww--right {
		right: var(
			--rlww-root-right,
			max(var(--rlww-side, 16px), calc(env(safe-area-inset-right, 0px) + 16px))
		) !important;
		left: auto !important;
	}

	.rlww--left {
		left: var(
			--rlww-root-left,
			max(var(--rlww-side, 16px), calc(env(safe-area-inset-left, 0px) + 16px))
		) !important;
		right: auto !important;
	}

	.rlww__bubble {
		width: 64px !important;
		height: 64px !important;
		min-width: 64px !important;
		max-width: 64px !important;
	}

	.rlww__panel {
		position: absolute;
		bottom: 76px;
		width: var(--rlww-panel-width, 340px) !important;
		max-width: var(--rlww-panel-max-width, 340px) !important;
		max-height: calc(100svh - 116px);
		overflow-x: clip;
		box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
		transform: scale(0.85) translateY(12px);
	}

	.rlww--right .rlww__panel {
		right: 0;
		left: auto !important;
		transform-origin: bottom right !important;
	}

	.rlww--left .rlww__panel {
		left: 0;
		right: auto !important;
		transform-origin: bottom left !important;
	}

	.rlww__panel.is-open {
		transform: scale(1) translateY(0);
	}

	.rlww__header {
		padding: 14px 16px;
	}

	.rlww__body {
		padding: 12px;
		max-height: calc(100svh - 260px);
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.rlww__message {
		font-size: 0.9rem;
	}

	.rlww__footer {
		padding: 10px 12px;
	}

	body.admin-bar .rlww__panel {
		max-height: calc(100svh - 162px);
	}

	.rlww--hide-mobile {
		display: none !important;
	}
}

@media (min-width: 768px) {
	.rlww--hide-desktop {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rlww__bubble,
	.rlww__panel,
	.rlww__send {
		transition: none;
	}

	.rlww__status-dot {
		animation: none;
	}
}
