:root {
	--rwzu-green: #65c13a;
	--rwzu-green-dark: #3c961d;
	--rwzu-green-deep: #2d7418;
	--rwzu-ink: #090b0f;
	--rwzu-copy: #40503b;
	--rwzu-muted: #65715f;
	--rwzu-line: #dbe9d3;
	--rwzu-pale: #f4faef;
	--rwzu-white: #ffffff;
}

.rwzu-assistant,
.rwzu-assistant * {
	box-sizing: border-box;
}

.rwzu-assistant {
	position: fixed;
	top: 60vh;
	right: max(1.2rem, env(safe-area-inset-right));
	z-index: 9998;
	color: var(--rwzu-copy);
	font-family: inherit;
}

.rwzu-assistant-launcher {
	display: inline-grid;
	width: 66px;
	height: 66px;
	place-items: center;
	padding: 0;
	border: 3px solid #fff;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--rwzu-green), var(--rwzu-green-dark));
	box-shadow: 0 14px 28px rgba(45, 116, 24, .34), 0 0 0 6px rgba(101, 193, 58, .16);
	color: #fff;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.rwzu-assistant-launcher:hover,
.rwzu-assistant-launcher:focus-visible {
	filter: saturate(1.08);
	box-shadow: 0 16px 32px rgba(45, 116, 24, .42), 0 0 0 7px rgba(101, 193, 58, .2);
	transform: scale(1.04);
}

.rwzu-assistant-launcher:focus-visible,
.rwzu-assistant-close:focus-visible,
.rwzu-assistant-voice-button:focus-visible,
.rwzu-assistant-write-button:focus-visible,
.rwzu-assistant-submit:focus-visible,
.rwzu-assistant-hint button:focus-visible {
	outline: 3px solid rgba(101, 193, 58, .54);
	outline-offset: 3px;
}

.rwzu-assistant-launcher-signal,
.rwzu-assistant-signal {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	height: 29px;
}

.rwzu-assistant-launcher-signal i,
.rwzu-assistant-signal i {
	display: block;
	width: 4px;
	border-radius: 999px;
	background: currentcolor;
}

.rwzu-assistant-launcher-signal i:nth-child(1),
.rwzu-assistant-signal i:nth-child(1) { height: 10px; }
.rwzu-assistant-launcher-signal i:nth-child(2),
.rwzu-assistant-signal i:nth-child(2) { height: 19px; }
.rwzu-assistant-launcher-signal i:nth-child(3),
.rwzu-assistant-signal i:nth-child(3) { height: 29px; }
.rwzu-assistant-launcher-signal i:nth-child(4),
.rwzu-assistant-signal i:nth-child(4) { height: 19px; }
.rwzu-assistant-launcher-signal i:nth-child(5),
.rwzu-assistant-signal i:nth-child(5) { height: 10px; }

.rwzu-assistant-hint {
	position: absolute;
	top: 50%;
	right: calc(100% + .8rem);
	width: max-content;
	max-width: min(270px, calc(100vw - 7rem));
	padding: .72rem .78rem .72rem .95rem;
	border: 1px solid var(--rwzu-line);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 12px 28px rgba(45, 116, 24, .18);
	color: var(--rwzu-ink);
	font-size: .9rem;
	font-weight: 700;
	line-height: 1.35;
	transform: translateY(-50%);
}

.rwzu-assistant-hint::after {
	position: absolute;
	top: 50%;
	right: -7px;
	width: 12px;
	height: 12px;
	border-top: 1px solid var(--rwzu-line);
	border-right: 1px solid var(--rwzu-line);
	background: #fff;
	content: '';
	transform: translateY(-50%) rotate(45deg);
}

.rwzu-assistant-hint span,
.rwzu-assistant-hint button {
	position: relative;
	z-index: 1;
}

.rwzu-assistant-hint button {
	margin-left: .45rem;
	padding: .1rem .2rem;
	border: 0;
	background: transparent;
	color: var(--rwzu-green-deep);
	font-size: 1.3rem;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
}

.rwzu-assistant-panel {
	position: fixed;
	/* Keep the panel anchored while interim speech results wrap to new lines. */
	top: clamp(1rem, 8svh, 5rem);
	right: max(1rem, env(safe-area-inset-right));
	width: min(410px, calc(100vw - 2rem));
	max-height: calc(100svh - 2rem);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	padding: 1.35rem;
	border: 1px solid var(--rwzu-line);
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 24px 54px rgba(45, 116, 24, .28);
	color: var(--rwzu-copy);
	transform: none;
}

.rwzu-assistant-panel[hidden],
.rwzu-assistant-hint[hidden],
.rwzu-assistant-text-entry[hidden],
.rwzu-assistant-transcript[hidden],
.rwzu-assistant-result[hidden],
[data-rwzu-submit-wrap][hidden] {
	display: none !important;
}

.rwzu-assistant-panel-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.rwzu-assistant-kicker {
	margin: 0 0 .3rem;
	color: var(--rwzu-green-deep);
	font-size: .73rem;
	font-weight: 800;
	letter-spacing: .1em;
	line-height: 1.25;
}

.rwzu-assistant-panel h2 {
	margin: 0;
	color: var(--rwzu-ink);
	font-size: clamp(1.45rem, 4.8vw, 2rem);
	font-weight: 800;
	line-height: 1.08;
}

.rwzu-assistant-close {
	display: grid;
	width: 34px;
	height: 34px;
	flex: 0 0 34px;
	place-items: center;
	padding: 0;
	border: 1px solid var(--rwzu-line);
	border-radius: 50%;
	background: var(--rwzu-pale);
	color: var(--rwzu-ink);
	font-size: 1.55rem;
	line-height: 1;
	cursor: pointer;
}

.rwzu-assistant-lead {
	margin: .85rem 0 1.25rem;
	color: var(--rwzu-copy);
	font-size: .98rem;
	line-height: 1.52;
}

.rwzu-assistant-form {
	margin: 0;
}

.rwzu-assistant-voice {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .7rem;
	padding: .35rem 1rem .2rem;
	border-radius: 21px;
	background: linear-gradient(180deg, #fff 0%, var(--rwzu-pale) 100%);
	text-align: center;
}

.rwzu-assistant-wave {
	position: absolute;
	top: 36px;
	left: 50%;
	display: flex;
	align-items: center;
	gap: 4px;
	height: 74px;
	color: rgba(101, 193, 58, .38);
	pointer-events: none;
	transform: translateX(-50%);
}

.rwzu-assistant-wave i {
	display: block;
	width: 4px;
	border-radius: 999px;
	background: currentcolor;
}

.rwzu-assistant-wave i:nth-child(1),
.rwzu-assistant-wave i:nth-child(7) { height: 16px; }
.rwzu-assistant-wave i:nth-child(2),
.rwzu-assistant-wave i:nth-child(6) { height: 30px; }
.rwzu-assistant-wave i:nth-child(3),
.rwzu-assistant-wave i:nth-child(5) { height: 48px; }
.rwzu-assistant-wave i:nth-child(4) { height: 65px; }

.rwzu-assistant-voice-button {
	position: relative;
	z-index: 1;
	display: grid;
	width: 116px;
	height: 116px;
	place-items: center;
	padding: 0;
	border: 6px solid #fff;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--rwzu-green), var(--rwzu-green-dark));
	box-shadow: 0 12px 24px rgba(45, 116, 24, .27), 0 0 0 8px rgba(101, 193, 58, .12);
	color: #fff;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.rwzu-assistant-voice-button:hover,
.rwzu-assistant-voice-button:focus-visible {
	filter: saturate(1.08);
	transform: scale(1.025);
}

.rwzu-assistant-voice-disc {
	display: grid;
	width: 66px;
	height: 66px;
	place-items: center;
	border: 1px solid rgba(255, 255, 255, .46);
	border-radius: 50%;
}

.rwzu-assistant-voice-copy {
	position: relative;
	z-index: 1;
	min-height: 2.8rem;
	color: var(--rwzu-ink);
	font-size: 1rem;
	font-weight: 800;
	line-height: 1.3;
}

.rwzu-assistant-voice-copy p {
	margin: .2rem 0 0;
	color: var(--rwzu-muted);
	font-size: .82rem;
	font-weight: 600;
	line-height: 1.35;
}

.rwzu-assistant.is-listening .rwzu-assistant-voice-button {
	box-shadow: 0 0 0 9px rgba(101, 193, 58, .2), 0 0 0 18px rgba(101, 193, 58, .08), 0 12px 24px rgba(45, 116, 24, .27);
	animation: rwzu-pulse 1.35s ease-in-out infinite;
}

.rwzu-assistant.is-listening .rwzu-assistant-wave i {
	animation: rwzu-wave 850ms ease-in-out infinite alternate;
}

.rwzu-assistant.is-listening .rwzu-assistant-wave i:nth-child(2),
.rwzu-assistant.is-listening .rwzu-assistant-wave i:nth-child(6) { animation-delay: 80ms; }
.rwzu-assistant.is-listening .rwzu-assistant-wave i:nth-child(3),
.rwzu-assistant.is-listening .rwzu-assistant-wave i:nth-child(5) { animation-delay: 150ms; }
.rwzu-assistant.is-listening .rwzu-assistant-wave i:nth-child(4) { animation-delay: 220ms; }

.rwzu-assistant-write-disclosure {
	display: flex;
	justify-content: center;
	margin-top: 1rem;
}

.rwzu-assistant-write-button {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	padding: .52rem .82rem;
	border: 1px solid var(--rwzu-line);
	border-radius: 999px;
	background: #fff;
	color: var(--rwzu-green-deep);
	font: inherit;
	font-size: .9rem;
	font-weight: 800;
	line-height: 1.2;
	cursor: pointer;
}

.rwzu-assistant-write-button > span:first-child {
	display: grid;
	width: 20px;
	height: 20px;
	place-items: center;
	border-radius: 50%;
	background: var(--rwzu-green);
	color: #fff;
	font-size: 1rem;
	line-height: 1;
}

.rwzu-assistant-text-entry {
	margin-top: 1rem;
}

.rwzu-assistant-transcript {
	position: relative;
	z-index: 1;
	width: 100%;
	min-height: 3.25rem;
	max-height: 3.25rem;
	margin: .15rem 0 0;
	padding: .08rem 0 .15rem;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--rwzu-copy);
	font-size: .82rem;
	font-weight: 600;
	line-height: 1.4;
	text-align: left;
	/* Reserve one compact feedback line: interim results do not resize the popup. */
	overflow-x: hidden;
	overflow-y: hidden;
}

.rwzu-assistant-transcript-label {
	display: block;
	margin-bottom: .04rem;
	color: var(--rwzu-green-deep);
	font-size: .71rem;
	font-weight: 800;
	letter-spacing: .04em;
	text-transform: uppercase;
}

.rwzu-assistant-transcript-value {
	display: block;
	max-height: 1.55rem;
	padding-right: .15rem;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	overflow-wrap: anywhere;
}

/* Preserve the compact space during listening without displaying an empty field. */
.rwzu-assistant.is-listening .rwzu-assistant-transcript[hidden] {
	display: block !important;
	visibility: hidden;
}

.rwzu-assistant-text-entry textarea {
	display: block;
	width: 100%;
	min-height: 84px;
	resize: vertical;
	padding: .8rem .9rem;
	border: 1px solid var(--rwzu-line);
	border-radius: 15px;
	background: #fff;
	color: var(--rwzu-ink);
	font: inherit;
	font-size: .96rem;
	line-height: 1.45;
	outline: 0;
}

.rwzu-assistant-text-entry textarea::placeholder {
	color: #7a8974;
	opacity: 1;
}

.rwzu-assistant-text-entry textarea:focus {
	border-color: var(--rwzu-green);
	box-shadow: 0 0 0 3px rgba(101, 193, 58, .2);
}

.rwzu-assistant.is-listening .rwzu-assistant-write-disclosure {
	display: none;
}

[data-rwzu-submit-wrap] {
	margin-top: .75rem;
}

.rwzu-assistant-submit {
	display: inline-flex;
	width: 100%;
	min-height: 45px;
	align-items: center;
	justify-content: center;
	padding: .68rem 1rem;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--rwzu-green), var(--rwzu-green-dark));
	box-shadow: 0 8px 18px rgba(45, 116, 24, .22);
	color: #fff;
	font: inherit;
	font-weight: 800;
	line-height: 1.2;
	cursor: pointer;
}

.rwzu-assistant-submit:disabled {
	background: #9aac91;
	box-shadow: none;
	cursor: wait;
	opacity: .82;
}

.rwzu-assistant-status {
	min-height: 1.3em;
	margin: .8rem 0 0;
	color: var(--rwzu-muted);
	font-size: .84rem;
	font-weight: 600;
	line-height: 1.45;
	text-align: center;
}

.rwzu-assistant-audio-details {
	margin-top: .85rem;
	border-top: 1px solid var(--rwzu-line);
	padding-top: .75rem;
	color: var(--rwzu-muted);
	font-size: .77rem;
	line-height: 1.45;
}

.rwzu-assistant-audio-details summary {
	color: var(--rwzu-copy);
	font-weight: 700;
	cursor: pointer;
}

.rwzu-assistant-audio-details p {
	margin: .55rem 0 0;
}

.rwzu-assistant-audio-details a {
	color: var(--rwzu-green-deep);
	font-weight: 800;
}

.rwzu-assistant-result {
	margin-top: 1rem;
	padding: .95rem 1rem;
	border: 1px solid var(--rwzu-line);
	border-radius: 16px;
	background: var(--rwzu-pale);
	color: var(--rwzu-copy);
	font-size: .94rem;
	line-height: 1.55;
}

.rwzu-assistant-result > p {
	margin: 0;
}

.rwzu-assistant-result a {
	color: var(--rwzu-green-deep);
	font-weight: 800;
}

.rwzu-assistant-result [data-rwzu-components] {
	display: grid;
	gap: .55rem;
	margin-top: .8rem;
}

.rwzu-assistant-result [data-rwzu-components] a {
	display: block;
	padding: .66rem .75rem;
	border: 1px solid var(--rwzu-line);
	border-radius: 11px;
	background: #fff;
	text-decoration: none;
}

@keyframes rwzu-pulse {
	50% { transform: scale(1.03); }
}

@keyframes rwzu-wave {
	to { transform: scaleY(1.45); }
}

@media (max-width: 700px) {
	.rwzu-assistant {
		top: 62svh;
		right: max(1rem, env(safe-area-inset-right));
	}

	.rwzu-assistant-launcher {
		width: 60px;
		height: 60px;
	}

	.rwzu-assistant-panel {
		top: max(.75rem, env(safe-area-inset-top));
		width: min(100% - 1.5rem, 410px);
		max-height: calc(100svh - 1.5rem);
		padding: 1.15rem;
	}

	.rwzu-assistant-hint {
		max-width: 205px;
		font-size: .82rem;
	}

	.rwzu-assistant-voice-button {
		width: 104px;
		height: 104px;
	}

	.rwzu-assistant-wave {
		top: 31px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rwzu-assistant-launcher,
	.rwzu-assistant-voice-button {
		transition: none;
	}

	.rwzu-assistant.is-listening .rwzu-assistant-voice-button,
	.rwzu-assistant.is-listening .rwzu-assistant-wave i {
		animation: none;
	}
}
