.wg-assistant {
	--wg-assistant-badge-size: 88px;
	--wg-assistant-character-width: 132px;
	--wg-assistant-character-bottom: -2px;
	--wg-assistant-character-shift: -60%;
	--wg-assistant-popout-cutoff: 44px;
	--wg-assistant-popout-window-offset: 10px;
	--wg-assistant-border-size: 4px;
	bottom: max(22px, env(safe-area-inset-bottom));
	position: fixed;
	right: max(22px, env(safe-area-inset-right));
	z-index: 99990;
}

.wg-assistant__trigger {
	background: transparent;
	border: 0;
	cursor: pointer;
	display: block;
	height: var(--wg-assistant-badge-size);
	overflow: visible;
	padding: 0;
	position: relative;
	width: var(--wg-assistant-badge-size);
	pointer-events: auto;
}

.wg-assistant__circle {
	background: #fff;
	border: var(--wg-assistant-border-size) solid var(--wg-green-dark, #087d35);
	border-radius: 50%;
	box-shadow: 0 8px 22px rgba(17, 24, 39, 0.2);
	inset: 0;
	overflow: hidden;
	pointer-events: none;
	position: absolute;
	transition: box-shadow 180ms ease, transform 180ms ease;
	z-index: 1;
}

.wg-assistant__trigger:hover .wg-assistant__circle {
	box-shadow: 0 13px 34px rgba(17, 24, 39, 0.26);
}

.wg-assistant__body-window {
	bottom: 0;
	left: 0;
	overflow: hidden;
	pointer-events: none;
	position: absolute;
	right: 0;
	top: calc(var(--wg-assistant-popout-cutoff) - var(--wg-assistant-border-size) - 2px);
}

.wg-assistant__character-window {
	bottom: var(--wg-assistant-popout-cutoff);
	height: calc(100% - var(--wg-assistant-popout-cutoff) + 48px);
	left: calc(50% + var(--wg-assistant-popout-window-offset));
	overflow: hidden;
	pointer-events: none;
	position: absolute;
	transform: translateX(-50%);
	width: 104px;
	z-index: 2;
}

.wg-assistant__circle img,
.wg-assistant__character-window img {
	bottom: var(--wg-assistant-character-bottom);
	display: block;
	height: auto;
	left: 50%;
	max-width: none;
	position: absolute;
	pointer-events: none;
	transform: translateX(var(--wg-assistant-character-shift));
	transform-origin: center bottom;
	transition: transform 180ms ease;
	width: var(--wg-assistant-character-width);
}

.wg-assistant__circle img {
	bottom: calc(var(--wg-assistant-character-bottom) - var(--wg-assistant-border-size));
}

.wg-assistant__character-window img {
	bottom: calc(var(--wg-assistant-character-bottom) - var(--wg-assistant-popout-cutoff));
	left: calc(50% - var(--wg-assistant-popout-window-offset));
}

.wg-assistant__trigger:hover .wg-assistant__circle img,
.wg-assistant__trigger:hover .wg-assistant__character-window img {
	transform: translateX(var(--wg-assistant-character-shift)) translateY(-3px) scale(1.03);
}

.wg-assistant__panel {
	background: #fff;
	border: 1px solid var(--wg-border-subtle, #e5e7eb);
	border-radius: 14px;
	bottom: calc(var(--wg-assistant-badge-size) + 42px);
	box-shadow: 0 20px 48px rgba(17, 24, 39, 0.2);
	padding: 20px;
	position: absolute;
	right: 0;
	width: min(350px, calc(100vw - 32px));
	z-index: 1;
}

.wg-assistant__panel::after {
	background: #fff;
	border-bottom: 1px solid var(--wg-border-subtle, #e5e7eb);
	border-right: 1px solid var(--wg-border-subtle, #e5e7eb);
	bottom: -7px;
	content: "";
	height: 14px;
	position: absolute;
	right: 34px;
	transform: rotate(45deg);
	width: 14px;
}

.wg-assistant__panel[hidden],
.wg-assistant__view[hidden] {
	display: none;
}

.wg-assistant__header {
	align-items: flex-start;
	display: flex;
	gap: 12px;
	justify-content: space-between;
	margin-bottom: 18px;
}

.wg-assistant__header h2 {
	font-size: 19px;
	line-height: 1.3;
	margin: 4px 0 0;
}

.wg-assistant__close {
	align-items: center;
	background: transparent;
	border: 0;
	color: var(--wg-muted, #5c6673);
	display: flex;
	font-size: 26px;
	height: 36px;
	justify-content: center;
	padding: 0;
	width: 36px;
}

.wg-assistant__actions {
	display: grid;
	gap: 10px;
}

.wg-assistant__actions button,
.wg-assistant__actions a,
.wg-assistant__back {
	align-items: center;
	background: var(--wg-surface, #f4f6f8);
	border: 1px solid transparent;
	border-radius: 8px;
	color: var(--wg-ink, #111827);
	display: flex;
	font-size: 14px;
	font-weight: 650;
	gap: 10px;
	justify-content: flex-start;
	line-height: 1.35;
	min-height: 50px;
	padding: 11px 14px;
	text-align: left;
	text-decoration: none;
	width: 100%;
}

.wg-assistant__actions button:hover,
.wg-assistant__actions a:hover,
.wg-assistant__back:hover {
	background: #fff;
	border-color: var(--wg-green, #159447);
	color: var(--wg-green-dark, #087d35);
}

.wg-assistant__actions button:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.wg-assistant__category-scroll {
	max-height: min(52vh, 360px);
	overflow-y: auto;
	padding-right: 4px;
}

.wg-assistant__categories {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wg-assistant__categories .wg-assistant__categories {
	border-left: 1px solid var(--wg-border-subtle, #e5e7eb);
	margin: 5px 0 8px 10px;
	padding-left: 12px;
}

.wg-assistant__categories a {
	border-radius: 6px;
	color: var(--wg-ink, #111827);
	display: block;
	font-size: 14px;
	padding: 8px 9px;
	text-decoration: none;
}

.wg-assistant__categories a:hover {
	background: var(--wg-surface, #f4f6f8);
	color: var(--wg-green-dark, #087d35);
}

.wg-assistant__back {
	margin-top: 14px;
}

.wg-assistant :is(button, a):focus-visible {
	outline: 3px solid rgba(21, 148, 71, 0.35);
	outline-offset: 2px;
}

@media (max-width: 689px) {
	.wg-assistant {
		--wg-assistant-badge-size: 72px;
		--wg-assistant-character-width: 107px;
		--wg-assistant-character-bottom: -8px;
		--wg-assistant-popout-cutoff: 36px;
		--wg-assistant-popout-window-offset: 8px;
		bottom: max(16px, env(safe-area-inset-bottom));
		right: max(14px, env(safe-area-inset-right));
	}

	.wg-assistant__character-window {
		height: calc(100% - var(--wg-assistant-popout-cutoff) + 38px);
		width: 86px;
	}

	.wg-assistant__panel {
		bottom: calc(var(--wg-assistant-badge-size) + 34px);
		max-height: calc(100vh - 118px - env(safe-area-inset-bottom));
		padding: 17px;
		right: 0;
	}

	.wg-assistant__panel::after {
		right: 26px;
	}
}

body.woocommerce-cart .wg-assistant,
body.woocommerce-checkout .wg-assistant {
	bottom: max(84px, calc(env(safe-area-inset-bottom) + 70px));
}

@media (prefers-reduced-motion: reduce) {
	.wg-assistant__circle,
	.wg-assistant__circle img,
	.wg-assistant__character-window img {
		transition: none;
	}

	.wg-assistant__trigger:hover .wg-assistant__circle img,
	.wg-assistant__trigger:hover .wg-assistant__character-window img {
		transform: translateX(var(--wg-assistant-character-shift));
	}
}
