/* Sacramentum Belli · Guardián */

.sbg {
	--sbg-vacuum: #0d0d10;
	--sbg-umbra: #17181b;
	--sbg-cinis: #2e3136;
	--sbg-ferrum: #6a7077;
	--sbg-argentum: #a6a9af;
	--sbg-reliquia: #d9dce1;
	--sbg-sanguis: #8c1a23;
	--sbg-stella: #e5505a;
	--sbg-art: #0f1015;
	--sbg-line: #34373e;
	--sbg-display: var(--wp--preset--font-family--cinzel, "Cinzel", "Trajan Pro", Georgia, serif);
	color: var(--sbg-reliquia);
	font-size: 15px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
.sbg *,
.sbg *::before,
.sbg *::after {
	box-sizing: border-box;
}
.sbg button {
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	margin: 0;
	min-height: 0;
	box-shadow: none;
}
.sbg-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}
.sbg .sbg-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

/* ---------- escenario ---------- */

.sbg-stage {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: var(--sbg-art);
	contain: layout paint;
}
.sbg-scene {
	position: absolute;
	left: 0;
	top: 0;
	opacity: 0;
	transition: opacity 0.5s ease;
	animation: sbg-float 7s ease-in-out infinite alternate;
	will-change: transform;
}
.sbg-stage.is-ready .sbg-scene {
	opacity: 1;
}
.sbg .sbg-scene img,
.sbg .sbg-scene canvas {
	position: absolute;
	display: block;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
}
.sbg .sbg-scene .sbg-base {
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
}
.sbg-l {
	position: absolute;
}
.sbg-halo-wrap {
	-webkit-mask-size: 100% 100%;
	mask-size: 100% 100%;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}
.sbg .sbg-scene .sbg-halo {
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	animation: sbg-spin 150s linear infinite;
	will-change: transform;
}
.sbg .sbg-scene .sbg-glow {
	mix-blend-mode: screen;
	opacity: 0;
	will-change: opacity;
}
.sbg-led {
	position: absolute;
	width: 1.3%;
	aspect-ratio: 1;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 190, 186, 0.95) 0, rgba(229, 80, 90, 0.75) 32%, rgba(140, 26, 35, 0) 70%);
	mix-blend-mode: screen;
	animation: sbg-led 2.6s ease-in-out infinite;
	pointer-events: none;
}
.sbg .sbg-scene .sbg-sparks {
	mix-blend-mode: screen;
}
.sbg-stage.is-paused .sbg-scene,
.sbg-stage.is-paused .sbg-halo,
.sbg-stage.is-paused .sbg-led {
	animation-play-state: paused;
}

@keyframes sbg-spin {
	to {
		transform: rotate(360deg);
	}
}
@keyframes sbg-float {
	from {
		transform: translate3d(0, -0.4%, 0);
	}
	to {
		transform: translate3d(0, 0.4%, 0);
	}
}
@keyframes sbg-led {
	0%, 100% {
		opacity: 0.55;
	}
	50% {
		opacity: 1;
	}
}

/* ---------- chat (común) ---------- */

.sbg-chat {
	display: flex;
	flex-direction: column;
	background: var(--sbg-vacuum);
	min-height: 0;
}
.sbg-head {
	position: relative;
	flex: 0 0 auto;
}
.sbg-title {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
}
.sbg-kicker {
	color: var(--sbg-stella);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.3em;
	text-transform: uppercase;
}
.sbg-name {
	font-family: var(--sbg-display);
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 0.06em;
	color: var(--sbg-reliquia);
	margin-top: 4px;
}
.sbg-sub {
	color: var(--sbg-argentum);
	font-size: 12px;
	letter-spacing: 0.04em;
	margin-top: 2px;
}
.sbg-tools {
	display: flex;
	gap: 6px;
}
.sbg .sbg-tool {
	width: 34px;
	height: 34px;
	padding: 0;
	display: grid;
	place-items: center;
	border-radius: 50%;
	border: 1px solid rgba(166, 169, 175, 0.28);
	background: rgba(13, 13, 16, 0.62);
	color: var(--sbg-reliquia);
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}
.sbg .sbg-tool:hover {
	border-color: var(--sbg-stella);
	color: #fff;
}
.sbg .sbg-tool:focus-visible,
.sbg .sbg-chip:focus-visible,
.sbg .sbg-send:focus-visible,
.sbg .sbg-retry:focus-visible,
.sbg .sbg-bubble a:focus-visible {
	outline: 2px solid var(--sbg-stella);
	outline-offset: 2px;
}
.sbg .sbg-tool[aria-pressed="true"] {
	color: var(--sbg-stella);
}

.sbg-log {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 16px 14px 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--sbg-cinis) transparent;
}
.sbg-msg {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	animation: sbg-in 0.22s ease-out;
}
.sbg-msg--user {
	align-items: flex-end;
}
.sbg-bubble {
	max-width: 88%;
	padding: 10px 13px;
	border-radius: 4px;
	font-size: 14.5px;
	line-height: 1.55;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}
.sbg-msg--guardian .sbg-bubble {
	background: var(--sbg-umbra);
	border: 1px solid var(--sbg-cinis);
	border-left: 2px solid var(--sbg-sanguis);
	white-space: normal;
}
.sbg-msg--user .sbg-bubble {
	background: #23252a;
	border: 1px solid var(--sbg-line);
	color: var(--sbg-reliquia);
}
.sbg-msg--error .sbg-bubble {
	border-left-color: var(--sbg-stella);
	color: var(--sbg-argentum);
}
.sbg-line {
	display: block;
}
.sbg-line + .sbg-line {
	margin-top: 0.4em;
}
.sbg-li {
	position: relative;
	padding-left: 1.15em;
}
.sbg-li::before {
	content: "";
	position: absolute;
	left: 0.15em;
	top: 0.62em;
	width: 0.38em;
	height: 0.38em;
	background: var(--sbg-stella);
	transform: rotate(45deg);
}
.sbg-ol::before {
	content: attr(data-n);
	width: auto;
	height: auto;
	top: 0;
	background: none;
	transform: none;
	color: var(--sbg-stella);
	font-size: 0.9em;
}
.sbg-li + .sbg-li {
	margin-top: 0.25em;
}
.sbg .sbg-bubble strong {
	color: #fff;
	font-weight: 600;
}
.sbg .sbg-bubble a {
	color: #f06b74;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}
.sbg .sbg-bubble a:hover {
	color: #fff;
}
.sbg .sbg-retry {
	margin-top: 6px;
	padding: 5px 10px;
	border-radius: 3px;
	border: 1px solid var(--sbg-sanguis);
	background: transparent;
	color: var(--sbg-reliquia);
	font-size: 12.5px;
	cursor: pointer;
}
.sbg .sbg-retry:hover {
	background: var(--sbg-sanguis);
}
.sbg-dots {
	display: inline-flex;
	gap: 6px;
	align-items: center;
	height: 1.4em;
}
.sbg-dots i {
	width: 6px;
	height: 6px;
	background: var(--sbg-stella);
	transform: rotate(45deg);
	opacity: 0.25;
	animation: sbg-ember 1.2s ease-in-out infinite;
}
.sbg-dots i:nth-child(2) {
	animation-delay: 0.18s;
}
.sbg-dots i:nth-child(3) {
	animation-delay: 0.36s;
}
@keyframes sbg-ember {
	0%, 100% {
		opacity: 0.2;
	}
	45% {
		opacity: 1;
		box-shadow: 0 0 8px rgba(229, 80, 90, 0.8);
	}
}
@keyframes sbg-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
}

.sbg-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 2px 14px 12px;
}
.sbg-chips[hidden] {
	display: none;
}
.sbg .sbg-chip {
	padding: 6px 11px;
	border-radius: 999px;
	border: 1px solid var(--sbg-line);
	background: transparent;
	color: var(--sbg-argentum);
	font-size: 12.5px;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s;
}
.sbg .sbg-chip:hover {
	border-color: var(--sbg-stella);
	color: var(--sbg-reliquia);
}

.sbg-form {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	margin: 0;
	padding: 10px 12px;
	border-top: 1px solid var(--sbg-cinis);
	background: var(--sbg-umbra);
}
.sbg .sbg-input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 42px;
	max-height: 120px;
	margin: 0;
	padding: 10px 12px;
	resize: none;
	border-radius: 4px;
	border: 1px solid var(--sbg-line);
	background: var(--sbg-vacuum);
	color: var(--sbg-reliquia);
	font: inherit;
	font-size: 16px;
	line-height: 1.35;
	box-shadow: none;
}
.sbg .sbg-input::placeholder {
	color: var(--sbg-ferrum);
	opacity: 1;
}
.sbg .sbg-input:focus {
	outline: none;
	border-color: var(--sbg-stella);
	box-shadow: 0 0 0 3px rgba(229, 80, 90, 0.18);
}
.sbg .sbg-input:disabled {
	opacity: 0.55;
}
.sbg .sbg-send {
	flex: 0 0 42px;
	width: 42px;
	height: 42px;
	padding: 0;
	display: grid;
	place-items: center;
	border-radius: 4px;
	border: 1px solid var(--sbg-sanguis);
	background: var(--sbg-sanguis);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}
.sbg .sbg-send:hover {
	background: #a3202b;
	border-color: var(--sbg-stella);
}
.sbg .sbg-send:disabled {
	opacity: 0.5;
	cursor: default;
}
.sbg-notice {
	margin: 0 !important;
	padding: 0 14px 10px;
	background: var(--sbg-umbra);
	color: var(--sbg-ferrum);
	font-size: 11.5px;
	line-height: 1.4;
}

/* ---------- burbuja ---------- */

.sbg-bubble-root {
	position: relative;
	z-index: 99990;
}
.sbg .sbg-launcher {
	position: fixed;
	right: max(18px, env(safe-area-inset-right));
	bottom: calc(18px + var(--sbg-offset, 0px) + env(safe-area-inset-bottom));
	z-index: 99990;
	width: 64px;
	height: 64px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid rgba(229, 80, 90, 0.6);
	background-color: var(--sbg-art);
	background-size: cover;
	background-position: center;
	box-shadow: 0 0 0 4px rgba(13, 13, 16, 0.78), 0 0 24px rgba(229, 80, 90, 0.38), 0 10px 26px rgba(0, 0, 0, 0.55);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sbg .sbg-launcher::before {
	content: "";
	position: absolute;
	inset: -8px;
	border-radius: 50%;
	border: 1px solid rgba(229, 80, 90, 0.4);
	animation: sbg-ring 3.4s ease-in-out infinite;
	pointer-events: none;
}
.sbg .sbg-launcher:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 0 0 4px rgba(13, 13, 16, 0.78), 0 0 34px rgba(229, 80, 90, 0.55), 0 12px 28px rgba(0, 0, 0, 0.6);
}
.sbg .sbg-launcher:focus-visible {
	outline: 2px solid var(--sbg-stella);
	outline-offset: 6px;
}
.sbg-launcher-tip {
	position: absolute;
	right: calc(100% + 14px);
	top: 50%;
	transform: translate(6px, -50%);
	padding: 6px 10px;
	border-radius: 3px;
	border: 1px solid var(--sbg-cinis);
	background: var(--sbg-umbra);
	color: var(--sbg-reliquia);
	font-size: 12.5px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s, transform 0.15s;
}
.sbg .sbg-launcher:hover .sbg-launcher-tip,
.sbg .sbg-launcher:focus-visible .sbg-launcher-tip {
	opacity: 1;
	transform: translate(0, -50%);
}
.sbg-bubble-root.is-open .sbg-launcher-tip {
	display: none;
}
@keyframes sbg-ring {
	0%, 100% {
		opacity: 0.25;
		transform: scale(0.96);
	}
	50% {
		opacity: 0.9;
		transform: scale(1.04);
	}
}

.sbg .sbg-teaser {
	position: fixed;
	right: 96px;
	bottom: calc(28px + var(--sbg-offset, 0px));
	z-index: 99989;
	max-width: 240px;
	padding: 10px 14px;
	border-radius: 4px;
	border: 1px solid var(--sbg-cinis);
	border-left: 2px solid var(--sbg-sanguis);
	background: var(--sbg-umbra);
	color: var(--sbg-reliquia);
	font-size: 13.5px;
	line-height: 1.4;
	text-align: left;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
	cursor: pointer;
	animation: sbg-in 0.3s ease-out;
	transition: opacity 0.35s;
}
.sbg .sbg-teaser.is-out {
	opacity: 0;
}

.sbg-panel {
	position: fixed;
	right: max(18px, env(safe-area-inset-right));
	bottom: calc(96px + var(--sbg-offset, 0px) + env(safe-area-inset-bottom));
	z-index: 99991;
	width: 400px;
	max-width: calc(100vw - 36px);
	height: min(660px, calc(100vh - 124px - var(--sbg-offset, 0px)));
	border: 1px solid var(--sbg-cinis);
	border-top-color: rgba(229, 80, 90, 0.5);
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 26px 60px rgba(0, 0, 0, 0.7), 0 0 44px rgba(140, 26, 35, 0.2);
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px) scale(0.98);
	transform-origin: bottom right;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
}
.sbg-panel.is-open {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s;
}
.sbg-panel.no-anim {
	transition: none !important;
}
.sbg-chat--bubble .sbg-head {
	height: 230px;
	background: var(--sbg-art);
	border-bottom: 1px solid var(--sbg-cinis);
	overflow: hidden;
}
.sbg-stage-host {
	position: absolute;
	inset: 0;
}
.sbg-chat--bubble .sbg-head::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 84px;
	background: linear-gradient(to bottom, rgba(13, 13, 16, 0), rgba(13, 13, 16, 0.94));
	pointer-events: none;
}
.sbg-chat--bubble .sbg-title {
	position: absolute;
	left: 16px;
	bottom: 12px;
	z-index: 2;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}
.sbg-chat--bubble .sbg-tools {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
}

/* ---------- página propia ---------- */

.sbg-page {
	display: grid;
	grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
	max-width: 1180px;
	margin: 0 auto;
	border: 1px solid var(--sbg-cinis);
	border-top-color: rgba(229, 80, 90, 0.5);
	background: var(--sbg-vacuum);
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}
.sbg-page-stage {
	position: relative;
	min-height: 600px;
	background: var(--sbg-art);
}
.sbg-page-stage .sbg-stage {
	position: absolute;
	inset: 0;
}
.sbg-chat--page {
	height: 640px;
	border-left: 1px solid var(--sbg-cinis);
}
.sbg-chat--page .sbg-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 16px 14px;
	border-bottom: 1px solid var(--sbg-cinis);
	background: var(--sbg-umbra);
}
.sbg-chat--page .sbg-tool {
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

/* ---------- móvil ---------- */

@media (max-width: 900px) {
	.sbg-page {
		grid-template-columns: 1fr;
	}
	.sbg-page-stage {
		min-height: 0;
		aspect-ratio: 4 / 3.1;
	}
	.sbg-chat--page {
		height: 580px;
		border-left: 0;
		border-top: 1px solid var(--sbg-cinis);
	}
}
@media (max-width: 600px) {
	.sbg-panel {
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		height: 100dvh;
		border-radius: 0;
		border: 0;
	}
	.sbg-chat--bubble .sbg-head {
		height: 190px;
	}
	.sbg-bubble-root.is-open .sbg-launcher {
		opacity: 0;
		pointer-events: none;
	}
	.sbg .sbg-launcher {
		width: 58px;
		height: 58px;
		right: max(14px, env(safe-area-inset-right));
		bottom: calc(14px + var(--sbg-offset, 0px) + env(safe-area-inset-bottom));
	}
	.sbg-chat--page {
		height: 540px;
	}
}
html.sbg-lock,
html.sbg-lock body {
	overflow: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
	.sbg-scene,
	.sbg .sbg-scene .sbg-halo,
	.sbg-led,
	.sbg .sbg-launcher::before,
	.sbg-msg,
	.sbg .sbg-teaser {
		animation: none !important;
	}
	.sbg-panel {
		transition: none !important;
	}
}
