.wiesi {
	--wiesi-green: #2f7d32;
	--wiesi-light: #eaf6e3;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: #1f2a1f;
}
.wiesi *, .wiesi *::before, .wiesi *::after { box-sizing: border-box; }
.wiesi-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Floating button */
.wiesi-toggle {
	position: relative;
	display: block;
	width: 84px;
	height: 84px;
	margin-left: auto;
	padding: 4px;
	border: 3px solid var(--wiesi-green);
	border-radius: 50%;
	background: var(--wiesi-light);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
	cursor: pointer;
	transition: transform .2s;
}
.wiesi-toggle:hover { transform: scale(1.06); }
.wiesi-toggle:focus-visible, .wiesi button:focus-visible, .wiesi input:focus-visible, .wiesi a:focus-visible {
	outline: 3px solid #f7c948;
	outline-offset: 2px;
}
.wiesi-svg { display: block; width: 100%; height: 100%; }
.wiesi-bubble {
	position: absolute;
	right: 90px;
	top: 22px;
	padding: 5px 10px;
	border-radius: 12px 12px 2px 12px;
	background: #fff;
	color: var(--wiesi-green);
	font-weight: 700;
	white-space: nowrap;
	box-shadow: 0 3px 10px rgba(0, 0, 0, .15);
	animation: wiesi-pop 6s ease-in-out infinite;
}
.wiesi-open .wiesi-bubble { display: none; }
.wiesi-toggle { cursor: grab; touch-action: none; }
.wiesi-dragging .wiesi-toggle { cursor: grabbing; transform: scale(1.1); transition: none; }
.wiesi-dragging .wiesi-bubble { display: none; }

/* Corner: left side and/or top (chat window then opens below the button) */
.wiesi-left { right: auto; left: 20px; }
.wiesi-left .wiesi-toggle { margin-left: 0; }
.wiesi-left .wiesi-bubble { right: auto; left: 90px; border-radius: 12px 12px 12px 2px; }
.wiesi-top { bottom: auto; top: 20px; display: flex; flex-direction: column-reverse; }
.wiesi-top .wiesi-panel { margin: 12px 0 0; }

/* Chat window */
.wiesi-panel {
	display: flex;
	flex-direction: column;
	width: min(370px, calc(100vw - 24px));
	height: min(540px, calc(100vh - 140px));
	margin-bottom: 12px;
	overflow: hidden;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
	animation: wiesi-in .25s ease-out;
}
.wiesi-panel[hidden] { display: none; }
.wiesi-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	background: var(--wiesi-green);
	color: #fff;
}
.wiesi-head-avatar { flex: 0 0 52px; height: 52px; padding: 2px; border-radius: 50%; background: var(--wiesi-light); }
.wiesi-title { flex: 1; display: flex; flex-direction: column; }
.wiesi-title small { opacity: .9; font-size: 12px; }
.wiesi-close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}
.wiesi-close:hover { background: rgba(255, 255, 255, .18); }
.wiesi-log {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px;
	background: #f7faf5;
}
.wiesi-msg {
	max-width: 85%;
	margin: 0 0 10px;
	padding: 9px 12px;
	border-radius: 14px;
	white-space: pre-line;
	overflow-wrap: anywhere;
}
.wiesi-bot { background: var(--wiesi-light); border-bottom-left-radius: 4px; }
.wiesi-user { margin-left: auto; background: var(--wiesi-green); color: #fff; border-bottom-right-radius: 4px; }
.wiesi-msg a { display: block; margin-top: 6px; color: var(--wiesi-green); font-weight: 600; text-decoration: underline; }
.wiesi-typing::after { content: "•••"; letter-spacing: 3px; animation: wiesi-dots 1s infinite; }
.wiesi-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e2e8df; }
.wiesi-form input {
	flex: 1;
	min-width: 0;
	padding: 10px 12px;
	border: 2px solid #cfdcc9;
	border-radius: 22px;
	font: inherit;
	color: inherit;
	background: #fff;
}
.wiesi-form input:focus { border-color: var(--wiesi-green); outline: none; }
.wiesi-form button {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--wiesi-green);
	color: #fff;
	font-size: 18px;
	cursor: pointer;
}
.wiesi-note { margin: 0; padding: 0 12px 8px; font-size: 11px; color: #5b6b58; }

/* Avatar animation */
.wiesi-svg g { transform-box: view-box; }
.wiesi-svg .w-eyes { transform-origin: 60px 45px; animation: wiesi-blink 4.5s infinite; }
.wiesi-svg .w-tail { transform-origin: 80px 102px; animation: wiesi-tail 3s ease-in-out infinite; }
.wiesi-svg .w-breathe { transform-origin: 60px 112px; animation: wiesi-breathe 3.2s ease-in-out infinite; }
.wiesi-svg .w-head { transform-origin: 60px 66px; animation: wiesi-tilt 7s ease-in-out infinite; }
.wiesi-svg .w-ear-r { transform-origin: 80px 38px; animation: wiesi-ear 5s infinite; }
.wiesi-svg .w-paw { transform-origin: 42px 90px; }
.wiesi-svg .w-mouth-open { opacity: 0; transform-origin: 60px 57px; transform-box: view-box; }
.wiesi-talking .w-mouth { opacity: 0; }
.wiesi-talking .w-mouth-open { opacity: 1; animation: wiesi-talk .22s ease-in-out infinite alternate; }
.wiesi-wave .w-paw, .wiesi-toggle:hover .w-paw { animation: wiesi-wave .8s ease-in-out 2; }

@keyframes wiesi-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes wiesi-tail { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes wiesi-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025, .985); } }
@keyframes wiesi-tilt { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-7deg); } 88% { transform: rotate(4deg); } }
@keyframes wiesi-ear { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(18deg); } 96% { transform: rotate(-6deg); } }
@keyframes wiesi-talk { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
@keyframes wiesi-wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-70deg); } }
@keyframes wiesi-pop { 0%, 75%, 100% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(-5px); } }
@keyframes wiesi-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes wiesi-dots { 50% { opacity: .3; } }

@media (max-width: 480px) {
	.wiesi { right: 12px; bottom: 12px; }
	.wiesi-left { right: auto; left: 12px; }
	.wiesi-top { bottom: auto; top: 12px; }
	.wiesi-toggle { width: 68px; height: 68px; }
	.wiesi-bubble { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.wiesi *, .wiesi *::after { animation: none !important; transition: none !important; }
	.wiesi-talking .w-mouth-open { transform: none; }
}
