/* Assistant Saint-Clar : couleurs du thème (rouge brique, fond crème, arrondis). */
.sca {
	--sca-rouge: #A33A2B;
	--sca-rouge-fonce: #7A2A20;
	--sca-texte: #231C1A;
	--sca-texte-doux: #5F5752;
	--sca-fond: #FFFFFF;
	--sca-creme: #FAF6F1;
	--sca-bordure: #EAE3DA;
	--sca-focus: #1A1A1A;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--sca-texte);
}
.sca *, .sca *::before, .sca *::after { box-sizing: border-box; }

.sca-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* ---- Bouton d'ouverture (mode flottant) ---- */
.sca[data-mode="flottant"] {
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 9990;
}
.sca[data-mode="flottant"].sca--gauche { right: auto; left: 1.25rem; }

.sca-launcher {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	min-height: 3rem;
	padding: .7rem 1.2rem;
	border: 2px solid var(--sca-rouge);
	border-radius: 999px;
	background: var(--sca-rouge);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(35, 28, 26, .22);
}
.sca-launcher:hover { background: var(--sca-rouge-fonce); border-color: var(--sca-rouge-fonce); }
.sca-avatar { display: block; flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 2px solid #fff; background: #FAF6F1; }
.sca-launcher { padding-left: .35rem; }
.sca-avatar--grand { width: 3.25rem; height: 3.25rem; }
.sca-header .sca-title { flex: 1 1 auto; }
.sca--ouvert .sca-launcher { display: none; }

/* ---- Fenêtre ---- */
.sca-panel {
	display: flex;
	flex-direction: column;
	background: var(--sca-fond);
	border: 1px solid var(--sca-bordure);
	border-radius: 18px;
	overflow: hidden;
}
.sca-panel[hidden] { display: none; }
.sca[data-mode="flottant"] .sca-panel {
	width: min(24rem, calc(100vw - 2rem));
	height: min(36rem, calc(100vh - 2.5rem));
	box-shadow: 0 12px 40px rgba(35, 28, 26, .28);
}
.sca[data-mode="integre"] .sca-panel {
	max-width: 46rem;
	height: 32rem;
	margin: 1.5rem 0;
}

.sca-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	padding: .8rem 1rem;
	background: var(--sca-rouge);
	color: #fff;
}
.sca .sca-title {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 1.1rem;
	line-height: 1.3;
	font-weight: 700;
	color: #fff;
}
.sca-subtitle { display: block; font-family: inherit; font-size: .85rem; font-weight: 400; opacity: .95; }
button.sca-close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 2.5rem; height: 2.5rem;
	min-width: 0; min-height: 0;
	margin: 0;
	padding: 0; /* le thème met 15px 30px sur tous les boutons */
	border: 2px solid rgba(255, 255, 255, .7);
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: #fff;
	font: inherit;
	font-size: 1.6rem;
	line-height: 1;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}
button.sca-close span { display: block; line-height: 1; margin-top: -.1em; }
button.sca-close:hover,
button.sca-close:focus { background: var(--sca-rouge-fonce); color: #fff; border-color: #fff; box-shadow: none; }

.sca-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 1rem;
	background: var(--sca-creme);
	display: flex;
	flex-direction: column;
	gap: .75rem;
}

.sca-msg {
	max-width: 90%;
	padding: .7rem .9rem;
	border-radius: 14px;
	overflow-wrap: anywhere;
}
.sca-msg p, .sca-msg ul, .sca-msg ol { margin: 0 0 .5rem; }
.sca-msg > :last-child, .sca-answer > :last-child { margin-bottom: 0; }
.sca-msg ul, .sca-msg ol { padding-left: 1.2rem; }
.sca-msg li { margin: .15rem 0; }

.sca-msg--bot {
	align-self: flex-start;
	background: var(--sca-fond);
	border: 1px solid var(--sca-bordure);
	border-bottom-left-radius: 4px;
}
.sca-msg--user {
	align-self: flex-end;
	background: var(--sca-rouge);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.sca-msg--bot a { color: var(--sca-rouge); text-decoration: underline; text-underline-offset: .15em; }
.sca-msg--bot a:hover { color: var(--sca-rouge-fonce); text-decoration-thickness: 2px; }
.sca-more { font-weight: 600; }
.sca-small { font-size: .9rem; color: var(--sca-texte-doux); }

.sca-choices { list-style: none; margin: .25rem 0 0; padding: 0 !important; display: flex; flex-wrap: wrap; gap: .4rem; }
.sca-choices li { margin: 0; }
.sca-choice {
	min-height: 2.5rem;
	padding: .4rem .8rem;
	border: 1px solid var(--sca-rouge);
	border-radius: 999px;
	background: var(--sca-fond);
	color: var(--sca-rouge);
	font: inherit;
	font-size: .92rem;
	text-align: left;
	cursor: pointer;
}
.sca-choice:hover { background: var(--sca-rouge); color: #fff; }

.sca-typing { display: inline-flex; gap: .3rem; padding: .9rem; }
.sca-typing span {
	width: .45rem; height: .45rem; border-radius: 50%;
	background: var(--sca-texte-doux);
	animation: sca-blink 1s infinite ease-in-out;
}
.sca-typing span:nth-child(2) { animation-delay: .15s; }
.sca-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sca-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.sca-form {
	display: flex;
	gap: .5rem;
	padding: .75rem;
	border-top: 1px solid var(--sca-bordure);
	background: var(--sca-fond);
}
.sca-label { display: block; }
.sca-input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 2.75rem;
	padding: .5rem .8rem;
	border: 2px solid var(--sca-texte-doux);
	border-radius: 12px;
	background: #fff;
	color: var(--sca-texte);
	font: inherit;
}
.sca-send {
	flex: none;
	min-height: 2.75rem;
	padding: .5rem 1rem;
	border: 2px solid var(--sca-rouge);
	border-radius: 12px;
	background: var(--sca-rouge);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.sca-send:hover { background: var(--sca-rouge-fonce); border-color: var(--sca-rouge-fonce); }

.sca-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .25rem .75rem;
	margin: 0;
	padding: 0 .75rem .6rem;
	background: var(--sca-fond);
	font-size: .8rem;
	color: var(--sca-texte-doux);
}
.sca-reset {
	padding: .2rem .1rem;
	border: 0;
	background: none;
	color: var(--sca-rouge);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* Focus toujours visible (RGAA 10.7) */
.sca button:focus-visible,
.sca a:focus-visible,
.sca input:focus-visible,
.sca-log:focus-visible {
	outline: 3px solid var(--sca-focus);
	outline-offset: 2px;
	box-shadow: 0 0 0 5px #fff;
}
.sca-header button:focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px var(--sca-texte); }
.sca-msg--user a { color: #fff; }

/* Petit écran : la fenêtre prend toute la largeur en bas */
@media (max-width: 600px) {
	.sca[data-mode="flottant"] { right: 1rem; bottom: 1rem; }
	.sca[data-mode="flottant"].sca--ouvert { left: 0; right: 0; bottom: 0; }
	.sca[data-mode="flottant"] .sca-panel {
		width: 100%;
		height: 85vh;
		height: 85dvh;
		border-radius: 18px 18px 0 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sca-typing span { animation: none; }
}

/* Mode contraste élevé de Windows */
@media (forced-colors: active) {
	.sca-msg, .sca-choice, .sca-launcher, .sca-send, .sca-panel { border: 1px solid CanvasText; }
}

@media print { .sca[data-mode="flottant"] { display: none; } }

/* Surprise (phrase secrète / code Konami) */
.sca-egg-img { display: block; width: 100%; max-width: 240px; height: auto; border-radius: 12px; margin: 0 0 .5rem; }
