.uoa-root {
	--uoa-accent: #111111;
	--uoa-on-accent: #ffffff;
	--uoa-ink: #111111;
	--uoa-muted: #6b6b6b;
	--uoa-bot: #f3f3f3;
	--uoa-strip: #f7f7f7;
	position: fixed;
	bottom: 20px;
	display: flex;
	flex-direction: column;
	z-index: 99990;
	font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--uoa-ink);
}
.uoa-root *,
.uoa-root *::before,
.uoa-root *::after { box-sizing: border-box; }
.uoa-root.uoa-pos-right { right: 20px; align-items: flex-end; }
.uoa-root.uoa-pos-left { left: 20px; align-items: flex-start; }

/* Round chat button: AI sparkle with a soft gradient ring (the classic bubble keeps the plain look) */
.uoa-fab {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--uoa-accent);
	background: linear-gradient(150deg, color-mix(in srgb, var(--uoa-accent) 72%, #ffffff) 0%, var(--uoa-accent) 58%);
	color: var(--uoa-on-accent);
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(20, 20, 45, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.25);
	transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease;
}
.uoa-fab:hover { transform: scale(1.06); }
.uoa-fab:active { transform: scale(0.97); }
.uoa-fab svg { position: relative; }

.uoa-ai .uoa-fab {
	box-shadow: 0 8px 24px rgba(20, 20, 45, 0.28), 0 0 20px rgba(130, 100, 255, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.25);
	animation: uoa-glow 3.6s ease-in-out infinite;
}
.uoa-ai .uoa-fab::before {
	content: "";
	position: absolute;
	inset: -3px;
	border-radius: 50%;
	background: conic-gradient(from 0deg, #4f8cff, #a259ff, #ff6ec4, #ffb86b, #4f8cff);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
	animation: uoa-ring 8s linear infinite;
	pointer-events: none;
}
.uoa-ai .uoa-fab[aria-expanded="true"] { animation: none; }
.uoa-ai .uoa-fab[aria-expanded="true"]::before { animation-play-state: paused; opacity: 0.55; }
.uoa-ai .uoa-fab .uoa-spark-s {
	transform-box: fill-box;
	transform-origin: center;
	animation: uoa-twinkle 3.2s ease-in-out infinite;
}
@keyframes uoa-ring { to { transform: rotate(360deg); } }
@keyframes uoa-glow {
	0%, 100% { box-shadow: 0 8px 24px rgba(20, 20, 45, 0.28), 0 0 18px rgba(130, 100, 255, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.25); }
	50% { box-shadow: 0 8px 24px rgba(20, 20, 45, 0.28), 0 0 30px rgba(255, 110, 196, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.25); }
}
@keyframes uoa-twinkle {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(0.7); opacity: 0.6; }
}

.uoa-root button:focus-visible,
.uoa-root a:focus-visible {
	outline: 3px solid #1a73e8;
	outline-offset: 2px;
}

/* Panel */
.uoa-panel {
	position: absolute;
	bottom: calc(100% + 12px);
	display: flex;
	flex-direction: column;
	width: 400px;
	max-width: calc(100vw - 24px);
	height: 640px;
	max-height: calc(100vh - 110px);
	max-height: calc(100dvh - 110px);
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 28px;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}
.uoa-panel[hidden] { display: none; }
.uoa-pos-right .uoa-panel { right: 0; }
.uoa-pos-left .uoa-panel { left: 0; }

/* Messages */
.uoa-log {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 20px 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	overscroll-behavior: contain;
}
.uoa-msg { display: flex; align-items: flex-start; gap: 10px; }
.uoa-msg.uoa-user { justify-content: flex-end; }

.uoa-avatar {
	flex: 0 0 36px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--uoa-accent);
	color: var(--uoa-on-accent);
	font-size: 17px;
	font-weight: 600;
	line-height: 1;
}
.uoa-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.uoa-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: calc(100% - 46px); }
.uoa-name { margin: 4px 0 0 2px; font-size: 12px; color: var(--uoa-muted); }

.uoa-bubble {
	padding: 10px 15px;
	border-radius: 20px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.uoa-bot .uoa-bubble { background: var(--uoa-bot); color: var(--uoa-ink); }
.uoa-user .uoa-bubble {
	max-width: 86%;
	background: var(--uoa-accent);
	color: var(--uoa-on-accent);
}
.uoa-bot .uoa-bubble a { color: #0b57d0; text-decoration: underline; }

.uoa-typing .uoa-bubble { display: inline-flex; gap: 5px; padding: 14px 16px; }
.uoa-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--uoa-muted);
	animation: uoa-pulse 1s infinite ease-in-out;
}
.uoa-dot:nth-child(2) { animation-delay: 0.15s; }
.uoa-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes uoa-pulse {
	0%, 80%, 100% { opacity: 0.3; }
	40% { opacity: 1; }
}

/* reCAPTCHA privacy text (shown instead of the hidden Google badge) */
.uoa-foot-rc {
	display: block;
	margin-top: 4px;
	font-size: 10.5px;
	line-height: 1.35;
}
.uoa-foot-rc a { color: inherit; text-decoration: underline; }

/* Typing effect: the real text is read once by screen readers, the visible copy is typed out */
.uoa-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.uoa-caret {
	display: inline-block;
	width: 2px;
	height: 1em;
	margin-left: 2px;
	vertical-align: -0.15em;
	background: currentColor;
	animation: uoa-blink 1s steps(1) infinite;
}
@keyframes uoa-blink {
	0%, 49% { opacity: 1; }
	50%, 100% { opacity: 0; }
}

/* Quick reply */
.uoa-chips {
	display: flex;
	flex: 0 0 auto;
	flex-wrap: wrap;
	gap: 6px;
	max-height: 38%;
	overflow-y: auto;
	padding: 2px 16px 10px 62px;
}
.uoa-chips[hidden] { display: none; }
.uoa-chip {
	text-align: left;
	max-width: 100%;
	margin: 0;
	padding: 6px 13px;
	border: 1.5px solid var(--uoa-accent);
	border-radius: 999px;
	background: #ffffff;
	color: var(--uoa-ink);
	font: inherit;
	font-size: 13.5px;
	line-height: 1.3;
	cursor: pointer;
}
.uoa-chip:hover { background: var(--uoa-bot); }

/* Cloudflare Turnstile box: stays empty (and hidden) unless a visitor must interact */
.uoa-ts { display: flex; justify-content: center; margin: 0 16px 8px; }
.uoa-ts:empty { display: none; margin: 0; }

/* Composer card */
.uoa-composer {
	margin: 0 12px 10px;
	padding: 12px 12px 10px 16px;
	border-radius: 24px;
	background: #ffffff;
	box-shadow: 0 2px 16px rgba(0, 0, 0, 0.14);
}
.uoa-input {
	display: block;
	width: 100%;
	min-height: 28px;
	max-height: 120px;
	margin: 0;
	padding: 2px 0 8px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--uoa-ink);
	font: inherit;
	font-size: 16px; /* stops iOS zooming on focus */
	line-height: 1.4;
	resize: none;
	overflow-y: auto;
}
.uoa-input:focus,
.uoa-input:focus-visible { outline: none; box-shadow: none; border: 0; }
.uoa-composer:focus-within { box-shadow: 0 2px 16px rgba(0, 0, 0, 0.14), 0 0 0 2px var(--uoa-accent); }
.uoa-input::placeholder { color: #8a8a8a; }
.uoa-input:disabled { opacity: 0.6; }

.uoa-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.uoa-new {
	margin: 0;
	padding: 6px 10px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--uoa-muted);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
.uoa-new:hover { background: var(--uoa-bot); color: var(--uoa-ink); }

.uoa-send {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--uoa-accent);
	color: var(--uoa-on-accent);
	cursor: pointer;
}
.uoa-send:disabled { background: #e4e4e4; color: #ffffff; cursor: default; }

/* Honeypot, off-screen rather than display:none so naive bots still fill it */
.uoa-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

/* Footer strip */
.uoa-foot {
	margin: 0;
	padding: 10px 20px 12px;
	background: var(--uoa-strip);
	font-size: 11.5px;
	line-height: 1.4;
	text-align: center;
	color: var(--uoa-muted);
}

/* Phones: panel fills the screen above the round button */
@media (max-width: 480px) {
	.uoa-root { bottom: 14px; }
	.uoa-root.uoa-pos-right { right: 14px; }
	.uoa-root.uoa-pos-left { left: 14px; }
	.uoa-panel {
		position: fixed;
		inset: 10px 10px calc(88px + env(safe-area-inset-bottom, 0px)) 10px;
		width: auto;
		max-width: none;
		height: auto;
		max-height: none;
		border-radius: 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.uoa-dot { animation: none; opacity: 0.7; }
	.uoa-caret { animation: none; }
	.uoa-fab:hover { transform: none; }
	.uoa-ai .uoa-fab,
	.uoa-ai .uoa-fab::before,
	.uoa-ai .uoa-fab .uoa-spark-s { animation: none; }
}
