#ysai-chat-root {
	--ysai-ink: #0c0c0d;
	--ysai-ink-soft: #1c1c1e;
	--ysai-accent: #2563eb;
	--ysai-accent-deep: #1d4ed8;
	position: fixed;
	z-index: 999999;
	right: 22px;
	bottom: 28px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Floating launcher: compact rounded-square, premium blue, no idle animation ---------- */

.ysai-toggle {
	position: relative;
	width: 56px;
	height: 56px;
	border-radius: 18px;
	background: linear-gradient(150deg, var(--ysai-accent), var(--ysai-accent-deep));
	color: #ffffff;
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(29, 78, 216, 0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ysai-toggle svg {
	width: 26px;
	height: 26px;
}

.ysai-toggle:hover,
.ysai-toggle:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 12px 26px rgba(29, 78, 216, 0.42);
}

.ysai-toggle:active {
	transform: translateY(-1px) scale(0.96);
	box-shadow: 0 6px 16px rgba(29, 78, 216, 0.35);
	transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.ysai-toggle-badge {
	position: absolute;
	top: -1px;
	right: -1px;
	width: 15px;
	height: 15px;
	border-radius: 50%;
	background: #e0304a;
	border: 2px solid #ffffff;
	display: none;
}

.ysai-toggle-badge.ysai-visible {
	display: block;
}

/* ---------- Attention bubble (first-time visitors only) ---------- */

.ysai-attention {
	position: absolute;
	right: 68px;
	bottom: 12px;
	max-width: 190px;
	background: #ffffff;
	color: var(--ysai-ink);
	padding: 9px 13px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.35;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	opacity: 0;
	transform: translateX(6px);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
	cursor: pointer;
	white-space: nowrap;
}

.ysai-attention::after {
	content: "";
	position: absolute;
	right: -5px;
	bottom: 16px;
	width: 10px;
	height: 10px;
	background: #ffffff;
	transform: rotate(45deg);
	box-shadow: 3px -3px 6px rgba(0, 0, 0, 0.03);
}

.ysai-attention.ysai-visible {
	opacity: 1;
	transform: translateX(0);
	pointer-events: auto;
}

/* ---------- Chat window ---------- */

.ysai-window {
	position: fixed;
	right: 22px;
	bottom: 96px;
	width: 366px;
	max-width: calc(100vw - 32px);
	height: 528px;
	max-height: calc(100vh - 140px);
	background: #ffffff;
	border-radius: 20px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: scale(0.94) translateY(10px);
	transform-origin: bottom right;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.ysai-window.ysai-open {
	opacity: 1;
	transform: scale(1) translateY(0);
	pointer-events: auto;
}

.ysai-header {
	background: linear-gradient(150deg, var(--ysai-ink-soft), var(--ysai-ink));
	color: #ffffff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.ysai-header-text {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.ysai-header-title {
	font-weight: 600;
	font-size: 15px;
	letter-spacing: 0.1px;
}

.ysai-header-subtitle {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.68);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ysai-online-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--ysai-accent);
	flex-shrink: 0;
}

.ysai-header button {
	background: rgba(255, 255, 255, 0.08);
	border: none;
	color: #ffffff;
	font-size: 15px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	line-height: 1;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.ysai-header button:hover {
	background: rgba(255, 255, 255, 0.16);
}

.ysai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #f7f7f8;
}

.ysai-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	max-width: 88%;
}

.ysai-row-user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.ysai-row-bot {
	align-self: flex-start;
}

.ysai-avatar {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: linear-gradient(150deg, var(--ysai-ink-soft), var(--ysai-ink));
	box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.35);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.2px;
}

.ysai-bubble-col {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ysai-row-user .ysai-bubble-col {
	align-items: flex-end;
}

.ysai-msg {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.ysai-msg-bot {
	background: #ffffff;
	border: 1px solid #e8e8e9;
	color: #111111;
	border-bottom-left-radius: 5px;
}

.ysai-msg-user {
	background: var(--ysai-ink);
	color: #ffffff;
	border-bottom-right-radius: 5px;
}

.ysai-timestamp {
	font-size: 10px;
	color: #9a9a9c;
	margin-top: 4px;
	padding: 0 3px;
}

.ysai-msg-typing {
	align-self: flex-start;
	color: #838385;
	font-size: 13px;
	font-style: italic;
}

.ysai-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 2px 2px 4px;
	align-self: flex-start;
	max-width: 100%;
}

.ysai-chip {
	background: #ffffff;
	border: 1px solid #e2e2e3;
	border-radius: 999px;
	padding: 8px 13px;
	font-size: 12.5px;
	cursor: pointer;
	color: #111111;
	white-space: nowrap;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.ysai-chip:hover {
	background: #f0f0f0;
	border-color: #cfcfd0;
}

.ysai-inputbar {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #eeeeee;
	background: #ffffff;
}

.ysai-inputbar textarea {
	flex: 1;
	resize: none;
	border: 1px solid #dddddd;
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 14px;
	font-family: inherit;
	max-height: 90px;
}

.ysai-inputbar textarea:focus {
	outline: none;
	border-color: var(--ysai-ink);
}

.ysai-inputbar button {
	background: var(--ysai-ink);
	color: #ffffff;
	border: none;
	border-radius: 12px;
	padding: 0 18px;
	height: 40px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.ysai-inputbar button:hover:not(:disabled) {
	opacity: 0.88;
}

.ysai-inputbar button:disabled {
	opacity: 0.45;
	cursor: default;
}

@media (max-width: 480px) {
	#ysai-chat-root {
		right: 18px;
		bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	}

	.ysai-toggle {
		width: 50px;
		height: 50px;
		border-radius: 16px;
	}

	.ysai-toggle svg {
		width: 24px;
		height: 24px;
	}

	.ysai-attention {
		right: 58px;
		max-width: 44vw;
		white-space: normal;
	}

	.ysai-window {
		right: 10px;
		left: 10px;
		bottom: 84px;
		width: auto;
		height: calc(100vh - 116px);
		max-height: calc(100dvh - 116px);
		border-radius: 18px;
	}
}
