#wp-rapidrescue-chat {
	position: fixed;
	right: 24px;
	bottom: 94px;
	z-index: 999999;

	width: 400px;
	max-width: calc(100vw - 32px);

	height: 600px;
	max-height: calc(100vh - 120px);

	display: flex;
	flex-direction: column;

	background: #0d1117;
	color: #e6edf3;

	border: 1px solid #30363d;
	border-radius: 16px;

	box-shadow:
		0 24px 70px rgba(0, 0, 0, 0.28),
		0 4px 14px rgba(0, 0, 0, 0.18);

	overflow: hidden;

	font-family:
		"JetBrains Mono",
		"SFMono-Regular",
		Consolas,
		"Liberation Mono",
		monospace;

	font-size: 13px;
	line-height: 1.6;

	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;

	opacity: 0;
	visibility: hidden;
	pointer-events: none;

	transform: translateY(12px) scale(0.98);

	transition:
		opacity 0.18s ease,
		visibility 0.18s ease,
		transform 0.18s ease;
}

#wp-rapidrescue-chat.wp-rapidrescue-chat--open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;

	transform: translateY(0) scale(1);
}

#wp-rapidrescue-chat * {
	box-sizing: border-box;
}

/*
 * Header.
 */
.wp-rapidrescue-chat__header {
	flex: 0 0 auto;

	display: flex;
	align-items: center;
	justify-content: space-between;

	padding: 15px 17px;

	background: #161b22;

	border-bottom: 1px solid #30363d;
}

.wp-rapidrescue-chat__brand {
	display: flex;
	align-items: center;
	gap: 11px;
}

.wp-rapidrescue-chat__brand-mark {
	width: 32px;
	height: 32px;

	display: flex;
	align-items: center;
	justify-content: center;

	background: #21262d;

	border: 1px solid #30363d;
	border-radius: 9px;
}

.wp-rapidrescue-chat__brand-mark span {
	display: block;

	width: 10px;
	height: 10px;

	background: #3fb950;

	border-radius: 50%;

	box-shadow:
		0 0 10px rgba(63, 185, 80, 0.45);
}

.wp-rapidrescue-chat__brand-text {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.wp-rapidrescue-chat__title {
	color: #f0f6fc;

	font-size: 13px;
	font-weight: 600;

	letter-spacing: -0.02em;
}

.wp-rapidrescue-chat__status {
	display: flex;
	align-items: center;
	gap: 6px;

	color: #8b949e;

	font-size: 10px;
	font-weight: 400;
}

.wp-rapidrescue-chat__status-dot {
	width: 5px;
	height: 5px;

	background: #3fb950;

	border-radius: 50%;
}

.wp-rapidrescue-chat__close {
	width: 30px;
	height: 30px;

	display: flex;
	align-items: center;
	justify-content: center;

	padding: 0;
	margin: 0;

	background: transparent;
	color: #8b949e;

	border: 1px solid transparent;
	border-radius: 7px;

	font-family: inherit;
	font-size: 22px;
	font-weight: 400;
	line-height: 1;

	cursor: pointer;

	transition:
		color 0.15s ease,
		background 0.15s ease,
		border-color 0.15s ease;
}

.wp-rapidrescue-chat__close:hover {
	background: #21262d;
	color: #f0f6fc;
	border-color: #30363d;
}

.wp-rapidrescue-chat__close:focus-visible {
	outline: 2px solid #635bff;
	outline-offset: 2px;
}

/*
 * Messages.
 */
.wp-rapidrescue-chat__messages {
	flex: 1 1 auto;

	display: flex;
	flex-direction: column;
	gap: 13px;

	padding: 20px 17px;

	overflow-y: auto;
	overflow-x: hidden;

	background:
		radial-gradient(
			circle at top right,
			rgba(99, 91, 255, 0.045),
			transparent 35%
		),
		#0d1117;

	scroll-behavior: smooth;
}

.wp-rapidrescue-chat__message {
	max-width: 86%;

	padding: 8px 11px;

	border-radius: 10px;

	word-wrap: break-word;
	overflow-wrap: anywhere;

	font-size: 12px;
	line-height: 1.55;

	animation:
		wp-rapidrescue-chat-message-in 0.18s ease-out;
}

@keyframes wp-rapidrescue-chat-message-in {

	from {
		opacity: 0;
		transform: translateY(4px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wp-rapidrescue-chat__message--assistant {
	align-self: flex-start;

	background: #161b22;
	color: #c9d1d9;

	border: 1px solid #30363d;

	border-bottom-left-radius: 3px;

	
}

.wp-rapidrescue-chat__message--user {
	align-self: flex-end;

	background: #635bff;
	color: #ffffff;

	border: 1px solid rgba(255, 255, 255, 0.08);

	border-bottom-right-radius: 3px;

 
}

.wp-rapidrescue-chat__message--loading {
	color: #8b949e;
}

/*
 * Thinking indicator.
 */
.wp-rapidrescue-chat__thinking {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.wp-rapidrescue-chat__thinking-label {
	color: #8b949e;
}

.wp-rapidrescue-chat__typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;

	height: 16px;
}

.wp-rapidrescue-chat__typing span {
	width: 4px;
	height: 4px;

	background: #8b949e;

	border-radius: 50%;

	animation:
		wp-rapidrescue-chat-dot 1.2s infinite ease-in-out;
}

.wp-rapidrescue-chat__typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.wp-rapidrescue-chat__typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes wp-rapidrescue-chat-dot {

	0%,
	60%,
	100% {
		opacity: 0.35;
		transform: translateY(0);
	}

	30% {
		opacity: 1;
		transform: translateY(-2px);
	}
}

/*
 * Debug trace.
 */
.wp-rapidrescue-chat__debug {
	align-self: stretch;

	width: 100%;
	max-width: 100%;

	margin: 0;
	padding: 10px 11px;

	background: #010409;
	color: #8b949e;

	border: 1px solid #30363d;
	border-left: 3px solid #d29922;
	border-radius: 6px;

	font-family:
		"JetBrains Mono",
		"SFMono-Regular",
		Consolas,
		"Liberation Mono",
		monospace;

	font-size: 9px;
	line-height: 1.55;

	white-space: pre-wrap;
	word-break: break-word;

	overflow-x: auto;

	animation:
		wp-rapidrescue-chat-message-in 0.18s ease-out;
}

/*
 * Composer.
 */
.wp-rapidrescue-chat__form {
	flex: 0 0 auto;

	padding: 11px 13px 12px;

	background: #161b22;

	border-top: 1px solid #30363d;
}

.wp-rapidrescue-chat__composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.wp-rapidrescue-chat__input {
	flex: 1 1 auto;

	width: 100%;
	min-width: 0;

	min-height: 42px;
	max-height: 120px;

	padding: 10px 11px;
	margin: 0;

	background: #0d1117;
	color: #e6edf3;

	border: 1px solid #30363d;
	border-radius: 8px;

	font-family: inherit;
	font-size: 12px;
	line-height: 1.5;

	resize: none;

	outline: none;

	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease,
		background 0.15s ease;
}

.wp-rapidrescue-chat__input:focus {
	background: #010409;

	border-color: #635bff;

	box-shadow:
		0 0 0 2px rgba(99, 91, 255, 0.15);
}

.wp-rapidrescue-chat__input::placeholder {
	color: #6e7681;
}

.wp-rapidrescue-chat__input:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/*
 * Send button.
 */
.wp-rapidrescue-chat__send {
	flex: 0 0 auto;

	width: 74px;
	height: 42px;

	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;

	padding: 0 10px;
	margin: 0;

	background: #635bff;
	color: #ffffff;

	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;

	font-family: inherit;
	font-size: 11px;
	font-weight: 600;

	cursor: pointer;

	transition:
		background 0.15s ease,
		transform 0.1s ease,
		opacity 0.15s ease;
}

.wp-rapidrescue-chat__send:hover {
	background: #5148e8;
}

.wp-rapidrescue-chat__send:active {
	transform: translateY(1px);
}

.wp-rapidrescue-chat__send:focus-visible {
	outline: 2px solid #8b85ff;
	outline-offset: 2px;
}

.wp-rapidrescue-chat__send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}

.wp-rapidrescue-chat__send-icon {
	font-size: 15px;
	line-height: 1;
}

.wp-rapidrescue-chat__hint {
	padding: 7px 2px 0;

	color: #6e7681;

	font-size: 9px;
	line-height: 1.4;

	text-align: right;
}

/*
 * Launcher.
 */
.wp-rapidrescue-chat__launcher {
	position: fixed;

	right: 24px;
	bottom: 24px;

	z-index: 1000000;

	width: 56px;
	height: 56px;

	display: flex;
	align-items: center;
	justify-content: center;

	padding: 0;
	margin: 0;

	background: #635bff;
	color: #ffffff;

	border: 0;
	border-radius: 50%;

	box-shadow:
		0 10px 28px rgba(0, 0, 0, 0.22),
		0 0 0 1px rgba(255, 255, 255, 0.08);

	cursor: pointer;

	-webkit-appearance: none;
	appearance: none;

	transition:
		background 0.15s ease,
		transform 0.15s ease,
		box-shadow 0.15s ease;
}

.wp-rapidrescue-chat__launcher:hover {
	background: #5148e8;

	transform: translateY(-2px);

	box-shadow:
		0 14px 32px rgba(0, 0, 0, 0.26),
		0 0 0 1px rgba(255, 255, 255, 0.1);
}

.wp-rapidrescue-chat__launcher:active {
	transform: translateY(0);
}

.wp-rapidrescue-chat__launcher:focus-visible {
	outline: 2px solid #8b85ff;
	outline-offset: 3px;
}

.wp-rapidrescue-chat__launcher-icon {
	display: flex;
	align-items: center;
	justify-content: center;

	width: 24px;
	height: 24px;

	line-height: 1;
}

.wp-rapidrescue-chat__launcher-icon--open {
	opacity: 1;
	transform: rotate(0deg) scale(1);

	transition:
		opacity 0.15s ease,
		transform 0.15s ease;
}

.wp-rapidrescue-chat__launcher-icon--close {
	position: absolute;

	opacity: 0;
	transform: rotate(-45deg) scale(0.7);

	font-size: 28px;
	font-weight: 300;

	transition:
		opacity 0.15s ease,
		transform 0.15s ease;
}

.wp-rapidrescue-chat__launcher[aria-expanded="true"]
.wp-rapidrescue-chat__launcher-icon--open {
	opacity: 0;
	transform: rotate(45deg) scale(0.7);
}

.wp-rapidrescue-chat__launcher[aria-expanded="true"]
.wp-rapidrescue-chat__launcher-icon--close {
	opacity: 1;
	transform: rotate(0deg) scale(1);
}

/*
 * Scrollbars.
 */
.wp-rapidrescue-chat__messages::-webkit-scrollbar {
	width: 7px;
}

.wp-rapidrescue-chat__messages::-webkit-scrollbar-track {
	background: transparent;
}

.wp-rapidrescue-chat__messages::-webkit-scrollbar-thumb {
	background: #30363d;
	border-radius: 10px;
}

.wp-rapidrescue-chat__messages::-webkit-scrollbar-thumb:hover {
	background: #484f58;
}

.wp-rapidrescue-chat__messages {
	scrollbar-width: thin;
	scrollbar-color: #30363d transparent;
}

/*
 * Screen-reader text.
 */
.screen-reader-text {
	position: absolute;

	width: 1px;
	height: 1px;

	padding: 0;
	margin: -1px;

	overflow: hidden;

	clip: rect(0, 0, 0, 0);

	white-space: nowrap;

	border: 0;
}

/*
 * Mobile.
 */
@media (max-width: 600px) {

	#wp-rapidrescue-chat {
		right: 10px;
		bottom: 76px;

		width: calc(100vw - 20px);
		max-width: none;

		height: min(680px, calc(100vh - 96px));
		max-height: calc(100vh - 96px);

		border-radius: 13px;
	}

	.wp-rapidrescue-chat__messages {
		padding: 16px 13px;
	}

	.wp-rapidrescue-chat__message {
		max-width: 90%;
	}

	.wp-rapidrescue-chat__form {
		padding: 10px;
	}

	.wp-rapidrescue-chat__hint {
		display: none;
	}

	.wp-rapidrescue-chat__send {
		width: 68px;
	}

	.wp-rapidrescue-chat__debug {
		font-size: 8px;
	}

	.wp-rapidrescue-chat__launcher {
		right: 16px;
		bottom: 16px;

		width: 52px;
		height: 52px;
	}
}

/*
 * Reduced motion.
 */
@media (prefers-reduced-motion: reduce) {

	#wp-rapidrescue-chat,
	#wp-rapidrescue-chat *,
	.wp-rapidrescue-chat__launcher {
		animation: none;
		transition: none;
	}

	#wp-rapidrescue-chat {
		transform: none;
	}
}