.sg-guardian {
	--sg-bg: #0a0211;
	--sg-bg-soft: #170523;
	--sg-violet: #330e54;
	--sg-violet-hover: #46156d;
	--sg-text: #fff4d2;
	--sg-muted: #b59ccc;
	--sg-gold: #f9dfa5;
	--sg-border: rgba(178, 158, 121, 0.78);
	--sg-shadow: rgba(5, 0, 10, 0.68);
}

.sg-guardian,
.sg-guardian * {
	box-sizing: border-box;
}

.sg-guardian {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99990;
	color: var(--sg-text);
	font-family: inherit;
	line-height: 1.45;
}

/*
 * Hostinger's administrator-only Kodee launcher uses the same bottom-right
 * corner. Keep both controls reachable while the WordPress admin bar is shown.
 */
body.admin-bar .sg-guardian {
	right: 400px;
}

.sg-guardian__trigger {
	display: flex;
	width: max-content;
	max-width: 100%;
	min-height: 60px;
	margin-left: auto;
	padding: 0;
	align-items: center;
	gap: 10px;
	color: var(--sg-gold);
	background: transparent;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: transform 180ms ease;
}

.sg-guardian__trigger:hover {
	background: transparent;
	transform: translateY(-2px);
}

.sg-guardian__trigger:focus-visible,
.sg-guardian__close:focus-visible,
.sg-guardian__option:focus-visible,
.sg-guardian__card-button:focus-visible,
.sg-guardian__vip-link:focus-visible,
.sg-guardian__restart:focus-visible {
	outline: 3px solid var(--sg-gold);
	outline-offset: 3px;
}

.sg-guardian__trigger-prompt {
	max-width: 230px;
	padding: 10px 14px;
	color: var(--sg-text);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.25;
	text-align: left;
	background: var(--sg-violet);
	border: 1px solid var(--sg-gold);
	border-radius: 999px;
	box-shadow: 0 12px 32px var(--sg-shadow);
	transition: background 180ms ease, border-color 180ms ease;
}

.sg-guardian__trigger:hover .sg-guardian__trigger-prompt {
	background: var(--sg-violet-hover);
	border-color: var(--sg-text);
}

.sg-guardian__trigger-avatar {
	display: block;
	flex: 0 0 60px;
	width: 60px;
	height: 60px;
	overflow: hidden;
	background: var(--sg-violet);
	border: 2px solid var(--sg-gold);
	border-radius: 50%;
	box-shadow: 0 12px 32px var(--sg-shadow);
}

.sg-guardian__trigger-avatar img,
.sg-guardian__header-icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 24%;
}

.sg-guardian--open .sg-guardian__trigger-prompt {
	display: none;
}

.sg-guardian__panel {
	position: absolute;
	right: 0;
	bottom: 68px;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 48px);
	max-height: 72vh;
	overflow: hidden;
	color: var(--sg-text);
	background: var(--sg-bg);
	border: 1px solid var(--sg-border);
	border-radius: 18px;
	box-shadow: 0 24px 64px var(--sg-shadow);
	transform-origin: right bottom;
	animation: sg-guardian-in 180ms ease-out;
}

.sg-guardian__panel[hidden] {
	display: none;
}

.sg-guardian__header {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 11px;
	min-height: 68px;
	padding: 12px 14px;
	background: var(--sg-bg-soft);
	border-bottom: 1px solid var(--sg-border);
}

.sg-guardian__header-icon {
	display: grid;
	flex: 0 0 38px;
	width: 38px;
	height: 38px;
	place-items: center;
	overflow: hidden;
	background: var(--sg-violet);
	border: 1px solid var(--sg-gold);
	border-radius: 50%;
}

.sg-guardian__identity {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.sg-guardian__identity strong {
	color: var(--sg-text);
	font-family: Georgia, "Times New Roman", serif;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.2;
}

.sg-guardian__identity small {
	margin-top: 2px;
	color: var(--sg-muted);
	font-size: 12px;
	letter-spacing: 0.02em;
}

.sg-guardian__close {
	display: grid;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	padding: 0;
	place-items: center;
	color: var(--sg-muted);
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.sg-guardian__close:hover {
	color: var(--sg-text);
	background: rgba(249, 223, 165, 0.08);
}

.sg-guardian__close svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-width: 1.8;
}

.sg-guardian__conversation {
	min-height: 220px;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-color: var(--sg-border) transparent;
}

.sg-guardian__messages {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 18px;
}

.sg-guardian__message {
	max-width: 89%;
	white-space: pre-line;
	overflow-wrap: anywhere;
	animation: sg-message-in 180ms ease-out;
}

.sg-guardian__message--guardian {
	align-self: flex-start;
	color: var(--sg-text);
	font-family: Georgia, "Times New Roman", serif;
	font-size: 16px;
}

.sg-guardian__message--visitor {
	align-self: flex-end;
	padding: 9px 12px;
	color: var(--sg-text);
	font-size: 14px;
	background: var(--sg-violet);
	border: 1px solid var(--sg-border);
	border-radius: 14px 14px 4px 14px;
}

.sg-guardian__message--deliberation,
.sg-guardian__message--aside {
	color: var(--sg-muted);
	font-style: italic;
}

.sg-guardian__options,
.sg-guardian__actions {
	display: grid;
	gap: 8px;
	width: 100%;
	animation: sg-message-in 180ms ease-out;
}

.sg-guardian__option {
	width: 100%;
	min-height: 44px;
	padding: 10px 13px;
	color: var(--sg-text);
	font: inherit;
	font-size: 14px;
	text-align: left;
	background: var(--sg-violet);
	border: 1px solid var(--sg-border);
	border-radius: 12px;
	cursor: pointer;
	transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.sg-guardian__option:hover {
	background: var(--sg-violet-hover);
	border-color: var(--sg-gold);
	transform: translateX(2px);
}

.sg-guardian__card {
	width: 100%;
	padding: 16px;
	background: linear-gradient(145deg, rgba(51, 14, 84, 0.96), rgba(23, 5, 35, 0.96));
	border: 1px solid var(--sg-border);
	border-radius: 15px;
	animation: sg-message-in 220ms ease-out;
}

.sg-guardian__card-eyebrow {
	display: block;
	margin-bottom: 5px;
	color: var(--sg-gold);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
}

.sg-guardian__card-title {
	margin: 0 0 8px;
	color: var(--sg-text);
	font-family: Georgia, "Times New Roman", serif;
	font-size: 21px;
	font-weight: 600;
	line-height: 1.2;
}

.sg-guardian__card-text {
	margin: 0 0 14px;
	color: var(--sg-muted);
	font-size: 14px;
}

.sg-guardian__card-button {
	display: inline-flex;
	min-height: 44px;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 10px 14px;
	color: var(--sg-gold);
	font-size: 14px;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	background: var(--sg-violet);
	border: 1px solid var(--sg-gold);
	border-radius: 10px;
	transition: background 160ms ease, transform 160ms ease;
}

.sg-guardian__card-button:hover {
	color: var(--sg-text);
	background: var(--sg-violet-hover);
	transform: translateY(-1px);
}

.sg-guardian__after-actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 7px;
}

.sg-guardian__vip-link,
.sg-guardian__restart {
	min-height: 44px;
	padding: 11px 0;
	color: var(--sg-gold);
	font: inherit;
	font-size: 13px;
	text-decoration: underline;
	text-decoration-color: rgba(249, 223, 165, 0.48);
	text-underline-offset: 3px;
	background: transparent;
	border: 0;
	cursor: pointer;
}

.sg-guardian__restart {
	color: var(--sg-muted);
}

.sg-guardian__vip-link:hover,
.sg-guardian__restart:hover {
	color: var(--sg-text);
}

@keyframes sg-guardian-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes sg-message-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 600px) {
	.sg-guardian {
		right: 12px;
		bottom: 12px;
		left: 12px;
	}

	body.admin-bar .sg-guardian {
		right: 12px;
	}

	body.admin-bar .sg-guardian__trigger {
		margin-right: auto;
		margin-left: 0;
	}

	body.admin-bar .sg-guardian__panel {
		bottom: 112px;
		max-height: calc(76dvh - 48px);
	}

	.sg-guardian__trigger {
		min-height: 56px;
		gap: 8px;
	}

	.sg-guardian__trigger-prompt {
		max-width: 140px;
		padding: 8px 10px;
		font-size: 12px;
	}

	.sg-guardian__trigger-avatar {
		flex-basis: 56px;
		width: 56px;
		height: 56px;
	}

	.sg-guardian__panel {
		right: 0;
		bottom: 64px;
		left: 0;
		width: auto;
		max-width: none;
		max-height: 76dvh;
	}

	.sg-guardian__messages {
		padding: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sg-guardian *,
	.sg-guardian *::before,
	.sg-guardian *::after {
		scroll-behavior: auto !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
