/* ARVIS – Arvis Boys : styles du chat. Les couleurs se changent ici. */
#ahb-root {
	--ahb-accent: #a93a43;
	--ahb-accent-dark: #86262f;
	--ahb-accent-soft: #f8e7e8;
	--ahb-bg: #fffaf6;
	--ahb-ink: #2c2024;
	--ahb-muted: #7a6a6e;
	--ahb-scene-top: #ffe3d0;
	--ahb-scene-bottom: #fff4ea;
	font-family: inherit;
	color: var(--ahb-ink);
}

#ahb-root *, #ahb-root *::before, #ahb-root *::after { box-sizing: border-box; }

/* Bouton flottant */
.ahb-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	width: 68px;
	height: 68px;
	padding: 0;
	border: 3px solid var(--ahb-accent);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 6px 20px rgba(60, 20, 30, .28);
	cursor: pointer;
	transition: transform .2s ease;
}
.ahb-launcher:hover, .ahb-launcher:focus-visible { transform: scale(1.06); }
.ahb-launcher img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; border-radius: 50%; display: block; }
.ahb-dot {
	position: absolute; top: -2px; right: -2px;
	width: 18px; height: 18px; border-radius: 50%;
	background: #ff4d6d; border: 2px solid #fff;
	animation: ahb-pulse 1.8s ease-in-out infinite;
}
.ahb-dot[hidden] { display: none; }
.ahb-countdown {
	position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%);
	padding: 2px 9px; white-space: nowrap;
	font-size: 12px; font-weight: 700; line-height: 1.5; color: #fff;
	background: #d4004f; border: 2px solid #fff; border-radius: 999px;
	box-shadow: 0 2px 6px rgba(60, 20, 30, .3);
}
.ahb-countdown[hidden] { display: none; }

/* Fenêtre */
.ahb-panel {
	position: fixed;
	right: 20px;
	bottom: 100px;
	z-index: 99991;
	display: flex;
	flex-direction: column;
	width: 410px;
	max-height: calc(100vh - 120px);
	max-height: min(740px, calc(100dvh - 120px));
	background: var(--ahb-bg);
	border-radius: 18px;
	box-shadow: 0 16px 48px rgba(60, 20, 30, .35);
	overflow: hidden;
	opacity: 0;
	transform: translateY(14px) scale(.98);
	transition: opacity .2s ease, transform .2s ease;
}
.ahb-panel[hidden] { display: none; }
/* Le thème peut ajouter des marges/espacements aux blocs : on les neutralise. */
#ahb-root .ahb-panel { margin: 0 !important; padding: 0 !important; min-height: 0 !important; }
.ahb-panel.is-open { opacity: 1; transform: none; }

/* Scène : le personnage, tel que dessiné, recadré */
.ahb-scene {
	position: relative;
	flex: 0 0 auto;
	height: clamp(150px, 24vh, 200px);
	overflow: hidden;
	background: linear-gradient(180deg, var(--ahb-scene-top), var(--ahb-scene-bottom));
}
.ahb-char {
	position: absolute;
	top: 14px;
	left: 50%;
	width: 230px;
	height: auto;
	margin-left: -70px;
	opacity: 0;
	transition: opacity .5s ease;
	pointer-events: none;
	user-select: none;
}
.ahb-char.is-on { opacity: 1; animation: ahb-float 5s ease-in-out infinite; }
.ahb-title {
	position: absolute; top: 10px; left: 10px;
	padding: 4px 11px;
	font-size: 13px; font-weight: 600;
	background: rgba(255, 255, 255, .85);
	border-radius: 999px;
}
.ahb-test {
	position: absolute; bottom: 8px; left: 10px;
	padding: 3px 9px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
	color: #fff; background: #d9822b; border-radius: 999px;
}
.ahb-test[hidden] { display: none; }
.ahb-close {
	position: absolute; top: 8px; right: 8px;
	width: 32px; height: 32px; padding: 0;
	font-size: 22px; line-height: 1;
	color: var(--ahb-ink);
	background: rgba(255, 255, 255, .85);
	border: 0; border-radius: 50%; cursor: pointer;
}
.ahb-close:hover { background: #fff; }

/* Neige de décembre : un décor derrière le personnage */
.ahb-snow { position: absolute; inset: 0; pointer-events: none; overflow: hidden; display: none; }
.ahb-scene.is-snow { background: linear-gradient(180deg, #c6dff3, #eaf4fb); }
.ahb-scene.is-snow .ahb-snow, .ahb-scene.is-petals .ahb-snow { display: block; }
.ahb-scene.is-petals { background: linear-gradient(180deg, #f9dfe9, #fff4ef); }
.ahb-flake {
	position: absolute; top: 0; border-radius: 50%;
	background: #fff; box-shadow: 0 0 4px rgba(255, 255, 255, .9);
	animation-name: ahb-snowfall; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes ahb-snowfall {
	from { transform: translate3d(0, -12px, 0); }
	to   { transform: translate3d(var(--drift, 0px), 230px, 0); }
}
@media (prefers-reduced-motion: reduce) {
	.ahb-flake, .ahb-petal { animation: none !important; top: var(--y, 20%); }
}

/* Cœurs flottants (autour du personnage, jamais sur son visage) */
.ahb-fx { position: absolute; inset: 0; pointer-events: none; }
.ahb-fx__heart {
	position: absolute; bottom: 8px;
	color: #ff5d7a;
	opacity: 0;
	animation: ahb-rise 1.8s ease-out forwards;
}

/* Jauge */
.ahb-gauge { flex: 0 0 auto; padding: 10px 26px 14px; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.ahb-gauge__label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; color: var(--ahb-muted); }
.ahb-gauge__label strong { color: var(--ahb-accent); }
.ahb-gauge__track { position: relative; height: 10px; background: #efdfe0; border-radius: 999px; }
.ahb-gauge__fill {
	height: 100%; width: 0;
	background: linear-gradient(90deg, #ff8fa3, var(--ahb-accent));
	border-radius: 999px;
	transition: width .8s ease;
}
.ahb-gauge__heart {
	position: absolute; top: 50%;
	transform: translate(-50%, -50%);
	display: grid; place-items: center;
	width: 22px; height: 22px;
	font-size: 13px; color: #c9b3b6;
	background: #fff;
	border: 2px solid #efdfe0; border-radius: 50%;
	transition: color .4s ease, border-color .4s ease, transform .4s ease;
}
.ahb-gauge__heart.is-full { color: #ff4d6d; border-color: var(--ahb-accent); transform: translate(-50%, -50%) scale(1.15); }

/* Choix du garçon */
.ahb-boys { flex: 0 0 auto; display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid rgba(0, 0, 0, .06); background: #fff; }
.ahb-boys[hidden] { display: none; }
.ahb-boy {
	flex: 1 1 0; display: flex; align-items: center; gap: 6px; min-width: 0;
	padding: 4px 8px 4px 4px; font: inherit; font-size: 12px; font-weight: 600; text-align: left;
	color: var(--ahb-ink); background: transparent; border: 1.5px solid transparent; border-radius: 999px; cursor: pointer;
}
.ahb-boy img { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: center 20%; background: #fff; border: 1px solid rgba(0, 0, 0, .1); }
.ahb-boy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahb-boy:hover:not(:disabled) { background: var(--ahb-accent-soft); }
.ahb-boy.is-on { background: var(--ahb-accent-soft); border-color: var(--ahb-accent); }
.ahb-boy:disabled { cursor: default; opacity: .55; }
.ahb-boy.is-on:disabled { opacity: 1; }

/* Messages */
.ahb-log { flex: 1 1 auto; min-height: 110px; padding: 14px 14px 6px; overflow-y: auto; scroll-behavior: smooth; }
.ahb-bio {
	margin: 0 0 14px; padding: 12px 14px;
	font-size: 13px; line-height: 1.5;
	background: var(--ahb-accent-soft);
	border-radius: 12px;
}
.ahb-bio strong { display: block; margin-bottom: 4px; color: var(--ahb-accent-dark); }
.ahb-bio p { margin: 0; }
.ahb-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.ahb-row--you { justify-content: flex-end; }
.ahb-row__avatar { flex: 0 0 30px; margin-top: 2px; width: 30px; height: 30px; border-radius: 50%; background: #fff; object-fit: cover; object-position: center 20%; border: 1px solid rgba(0, 0, 0, .08); }
.ahb-bubble { max-width: 82%; padding: 10px 14px; font-size: 15px; line-height: 1.4; border-radius: 16px; animation: ahb-pop .2s ease; }
.ahb-row--boy .ahb-bubble { background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.ahb-row--you .ahb-bubble { color: #fff; background: var(--ahb-accent); border-bottom-right-radius: 4px; }
.ahb-inline-link {
	display: block; margin-top: 8px; font-size: 13px; font-weight: 600;
	color: var(--ahb-accent-dark) !important; text-decoration: underline;
}
.ahb-typing .ahb-bubble { display: flex; gap: 4px; padding: 12px 14px; }
.ahb-typing .ahb-bubble span { width: 7px; height: 7px; background: #c5b3b6; border-radius: 50%; animation: ahb-blink 1s infinite ease-in-out; }
.ahb-typing .ahb-bubble span:nth-child(2) { animation-delay: .15s; }
.ahb-typing .ahb-bubble span:nth-child(3) { animation-delay: .3s; }

/* Réponses et appels à l'action */
.ahb-tray { flex: 0 0 auto; display: flex; flex-direction: column; gap: 7px; padding: 8px 14px 14px; min-height: 8px; max-height: 62vh; overflow-y: auto; scrollbar-width: thin; }
.ahb-choice {
	flex: 0 0 auto;
	padding: 11px 14px; font: inherit; font-size: 15px; text-align: left;
	color: var(--ahb-accent-dark); background: #fff;
	border: 1.5px solid var(--ahb-accent); border-radius: 12px; cursor: pointer;
	transition: background .15s ease, color .15s ease;
}
.ahb-choice:hover, .ahb-choice:focus-visible { color: #fff; background: var(--ahb-accent); }
.ahb-book {
	display: block; padding: 9px 14px; text-align: center; text-decoration: none;
	font-size: 13px; font-weight: 600; color: var(--ahb-accent-dark) !important;
	background: var(--ahb-accent-soft); border-radius: 12px;
}
.ahb-book:hover { background: #f1d3d5; }
.ahb-cta {
	display: block; padding: 11px 14px; text-align: center; text-decoration: none;
	font-size: 14px; font-weight: 600; color: #fff !important;
	background: var(--ahb-accent); border-radius: 12px;
}
.ahb-cta:hover { background: var(--ahb-accent-dark); }
.ahb-reward { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; font-size: 13px; background: #fff4e5; border: 1.5px dashed #d9822b; border-radius: 12px; }
.ahb-note { margin: 0; font-size: 13px; text-align: center; color: var(--ahb-muted); }

/* Animations */
@keyframes ahb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes ahb-rise { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-150px) scale(1.1); } }
@keyframes ahb-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ahb-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@keyframes ahb-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }

@media (prefers-reduced-motion: reduce) {
	#ahb-root * { animation: none !important; transition: none !important; }
}

/* Écrans peu hauts (portables, zoom du navigateur) : le grand décor devient un bandeau, ce qui libère
   de la place pour lire plusieurs messages ET voir tous les choix. */
@media (max-height: 820px) {
	.ahb-panel { max-height: calc(100vh - 108px); max-height: min(760px, calc(100dvh - 108px)); }
	.ahb-scene { height: clamp(72px, 11vh, 96px); }
	.ahb-char { top: 6px; width: 176px; margin-left: -43px; }
	.ahb-gauge { padding-top: 6px; padding-bottom: 8px; }
	.ahb-boys { padding: 3px 10px; }
	.ahb-boy img { flex-basis: 24px; width: 24px; height: 24px; }
	.ahb-log { min-height: 170px; padding-top: 10px; }
	.ahb-choice { padding: 7px 14px; font-size: 14px; }
	.ahb-book { padding: 6px 12px; font-size: 12.5px; }
	.ahb-tray { gap: 5px; padding: 6px 14px 10px; max-height: 44vh; }
}
@media (max-height: 660px) {
	.ahb-tray { flex-shrink: 1; }
	.ahb-log { flex-shrink: 6; }
}
@media (max-height: 640px) {
	.ahb-scene { height: 56px; }
	.ahb-log { min-height: 140px; }
	.ahb-tray { max-height: 46vh; }
}

/* Mobile */
@media (max-width: 480px) {
	.ahb-panel { right: 8px; left: 8px; bottom: 92px; width: auto; max-height: calc(100vh - 104px); max-height: calc(100dvh - 104px); }
	.ahb-launcher { right: 14px; bottom: 14px; }
	.ahb-scene { height: clamp(130px, 21vh, 170px); }
	.ahb-char { width: 200px; margin-left: -60px; }
}

/* Séparateur discret entre deux parties de la conversation (ex. concours puis jeu) */
.ahb-sep {
	display: flex; align-items: center; gap: 10px; margin: 6px 0 14px;
	font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--ahb-muted, #9a8a8f); text-transform: none;
}
.ahb-sep::before, .ahb-sep::after { content: ''; flex: 1; height: 1px; background: currentColor; opacity: .35; }

/* Pétales de printemps (avril) : petits pétales roses qui tombent en tournoyant doucement */
.ahb-petal {
	position: absolute; top: 0;
	background: linear-gradient(135deg, #ffd3e0, #f59db8);
	border-radius: 80% 0 80% 0;
	animation-name: ahb-petalfall; animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}
@keyframes ahb-petalfall {
	0%   { transform: translate3d(0, -14px, 0) rotate(var(--rot, 0deg)); }
	50%  { transform: translate3d(calc(var(--drift, 0px) * .5), 110px, 0) rotate(calc(var(--rot, 0deg) + 160deg)); }
	100% { transform: translate3d(var(--drift, 0px), 230px, 0) rotate(calc(var(--rot, 0deg) + 320deg)); }
}

/* Zone de choix : une ombre en bas (ou en haut) signale qu'il reste des choix à faire défiler */
.ahb-tray {
	background:
		linear-gradient(var(--ahb-bg) 30%, rgba(255, 255, 255, 0)) center top,
		linear-gradient(rgba(255, 255, 255, 0), var(--ahb-bg) 70%) center bottom,
		radial-gradient(farthest-side at 50% 0, rgba(60, 20, 30, .28), rgba(60, 20, 30, 0)) center top,
		radial-gradient(farthest-side at 50% 100%, rgba(60, 20, 30, .28), rgba(60, 20, 30, 0)) center bottom;
	background-repeat: no-repeat;
	background-size: 100% 24px, 100% 24px, 100% 10px, 100% 10px;
	background-attachment: local, local, scroll, scroll;
}

/* Choix du garçon avant qu'il parle */
.ahb-pick { margin: auto; padding: 14px 18px; text-align: center; display: flex; flex-direction: column; gap: 6px; max-width: 280px; color: #5a4650; font-size: 14px; line-height: 1.4; }
.ahb-pick strong { font-size: 16px; color: #3b2a33; }
.ahb-boys.is-picking { background: #fff6f9; }
.ahb-boys.is-picking .ahb-boy:not(:disabled) { animation: ahb-pick-pulse 1.6s ease-in-out infinite; }
@keyframes ahb-pick-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .ahb-boys.is-picking .ahb-boy { animation: none; } }

/* Accroche de première visite : entrée du bouton, halo, bulle d'invitation */
.ahb-launcher.is-hello { animation: ahb-hello-pop .9s cubic-bezier(.2, 1.4, .4, 1) both, ahb-hello-bob 2.2s ease-in-out 1s infinite; }
.ahb-launcher.is-hello::before,
.ahb-launcher.is-hello::after {
	content: ""; position: absolute; inset: -3px; border-radius: 50%;
	border: 3px solid var(--ahb-accent); opacity: 0; pointer-events: none;
	animation: ahb-hello-ring 2.2s ease-out 1s infinite;
}
.ahb-launcher.is-hello::after { animation-delay: 1.8s; }
@keyframes ahb-hello-pop { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.25) rotate(6deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes ahb-hello-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes ahb-hello-ring { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(1.9); opacity: 0; } }

.ahb-teaser {
	position: fixed; right: 100px; bottom: 30px; z-index: 99989; max-width: min(250px, calc(100vw - 130px));
	display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; cursor: pointer;
	padding: 10px 14px; border: 2px solid var(--ahb-accent); border-radius: 16px 16px 4px 16px;
	background: #fff; color: var(--ahb-ink); box-shadow: 0 8px 24px rgba(60, 20, 30, .25);
	opacity: 0; transform: translateX(14px) scale(.92); transition: opacity .3s ease, transform .3s ease;
}
.ahb-teaser.is-in { opacity: 1; transform: none; }
.ahb-teaser strong { font-size: 14px; color: var(--ahb-accent-dark); line-height: 1.3; }
.ahb-teaser span { font-size: 12.5px; color: var(--ahb-muted); line-height: 1.3; }
@media (max-width: 600px) { .ahb-teaser { right: 90px; bottom: 24px; } }
@media (prefers-reduced-motion: reduce) {
	.ahb-launcher.is-hello, .ahb-launcher.is-hello::before, .ahb-launcher.is-hello::after { animation: none; }
	.ahb-launcher.is-hello { box-shadow: 0 0 0 6px rgba(169, 58, 67, .3), 0 6px 20px rgba(60, 20, 30, .28); }
	.ahb-teaser { transition: none; }
}

/* Rappel discret (séance du jour, nouveau mois) : pas de grande entrée, juste le halo et un petit rebond */
.ahb-launcher.is-hello.is-soft { animation: ahb-hello-bob 2.2s ease-in-out infinite; }
.ahb-launcher.is-hello.is-soft::before, .ahb-launcher.is-hello.is-soft::after { animation-delay: 0s; }
.ahb-launcher.is-hello.is-soft::after { animation-delay: .8s; }
@media (prefers-reduced-motion: reduce) { .ahb-launcher.is-hello.is-soft { animation: none; } }
