/* ==========================================================================
   Sérafin — bulle de l'assistant IA + bouton « haut de page »
   ========================================================================== */
.sr-root{--sr-r:20px;--sr-b:20px;position:fixed;right:var(--sr-r);bottom:var(--sr-b);z-index:9400;font-family:var(--font,system-ui)}
.sr-launch{position:relative;width:66px;height:66px;border-radius:50%;border:0;padding:0;cursor:pointer;background:transparent;box-shadow:0 0 0 3px var(--accent,#DCD60C),0 14px 34px rgba(0,0,0,.45);animation:srBob 4s ease-in-out infinite;transition:transform .2s}
.sr-launch:hover{transform:scale(1.06)}
.sr-launch svg,.sr-launch img{width:100%;height:100%;border-radius:50%;display:block}
.sr-launch .sr-dot{position:absolute;top:2px;right:2px;width:14px;height:14px;border-radius:50%;background:#2FD08A;border:2px solid #0B1730}
.sr-root.open .sr-launch{animation:none}
@keyframes srBob{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
.sr-teaser{position:absolute;right:78px;bottom:10px;width:max-content;max-width:240px;padding:11px 14px;border-radius:16px 16px 4px 16px;background:#fff;color:#0D1B33;font-size:13.5px;font-weight:600;line-height:1.45;box-shadow:0 14px 34px rgba(0,0,0,.3);animation:srPop .35s ease-out;cursor:pointer}
.sr-teaser b{color:#275285}
.sr-teaser .x{position:absolute;top:-8px;left:-8px;width:22px;height:22px;border-radius:50%;border:0;background:#0B1730;color:#fff;font-size:11px;cursor:pointer}
@keyframes srPop{from{opacity:0;transform:translateY(8px) scale(.96)}to{opacity:1;transform:none}}

.sr-panel{position:absolute;right:0;bottom:82px;width:min(390px,calc(100vw - 28px));height:min(600px,calc(100vh - 120px));display:flex;flex-direction:column;background:var(--bg-2,#0B1730);border:1px solid var(--line-2,rgba(255,255,255,.14));border-radius:22px;box-shadow:0 30px 80px rgba(0,0,0,.5);overflow:hidden;animation:srPop .25s ease-out;color:var(--text,#E9EEF7)}
.sr-head{display:flex;align-items:center;gap:12px;padding:14px 14px 14px 16px;background:linear-gradient(120deg,#275285,#1D3B5F);border-bottom:1px solid rgba(255,255,255,.08)}
.sr-head .sr-av{width:48px;height:48px;border-radius:50%;overflow:hidden;box-shadow:0 0 0 2px #DCD60C;flex-shrink:0}
.sr-head .sr-av svg,.sr-head .sr-av img{width:100%;height:100%;display:block}
.sr-head .sr-id{flex:1;min-width:0;color:#fff}
.sr-head .sr-id b{display:block;font-family:var(--display,inherit);font-size:16px}
.sr-head .sr-id span{font-size:12px;color:#C9D6EA;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sr-head .sr-id span::before{content:"";width:7px;height:7px;border-radius:50%;background:#2FD08A}
.sr-hbtn{width:34px;height:34px;border-radius:10px;border:0;background:rgba(255,255,255,.1);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:13px}
.sr-hbtn:hover{background:rgba(255,255,255,.2)}
.sr-hbtn.on{background:#DCD60C;color:#0A1426}
.sr-body{flex:1;overflow-y:auto;padding:16px 14px;display:flex;flex-direction:column;gap:10px;scroll-behavior:smooth}
.sr-msg{display:flex;gap:8px;align-items:flex-end;max-width:92%;animation:srPop .25s ease-out}
.sr-msg .mini{width:28px;height:28px;border-radius:50%;overflow:hidden;flex-shrink:0;box-shadow:0 0 0 1.5px #DCD60C}
.sr-msg .mini img{width:100%;height:100%;display:block}
.sr-msg .txt{padding:10px 13px;border-radius:16px 16px 16px 4px;background:var(--surface-3,rgba(255,255,255,.07));font-size:14px;line-height:1.55;white-space:pre-line;word-wrap:break-word}
.sr-msg.me{align-self:flex-end;flex-direction:row-reverse}
.sr-msg.me .txt{background:#DCD60C;color:#0A1426;border-radius:16px 16px 4px 16px;font-weight:600}
.sr-msg.cont .mini{visibility:hidden}
.sr-typing .txt{display:flex;gap:4px;padding:13px 14px}
.sr-typing i{width:7px;height:7px;border-radius:50%;background:var(--muted,#9AAAC4);animation:srDot 1.2s infinite}
.sr-typing i:nth-child(2){animation-delay:.15s}.sr-typing i:nth-child(3){animation-delay:.3s}
@keyframes srDot{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-4px)}}
.sr-chips{display:flex;flex-wrap:wrap;gap:6px;padding-left:36px}
.sr-chip{border:1px solid var(--line-2,rgba(255,255,255,.14));background:transparent;color:var(--text,#E9EEF7);border-radius:999px;padding:6px 11px;font:600 12.5px var(--font,system-ui);cursor:pointer;text-align:left}
.sr-chip:hover{border-color:#DCD60C;color:#DCD60C}
.sr-chip.guide{border-color:rgba(47,208,138,.4);color:#2FD08A}
.sr-act{margin-left:36px;align-self:flex-start;display:inline-flex;align-items:center;gap:8px;padding:8px 14px;border-radius:12px;background:#DCD60C;color:#0A1426;font-weight:700;font-size:13px;text-decoration:none}
.sr-foot{display:flex;align-items:flex-end;gap:8px;padding:10px 12px 12px;border-top:1px solid var(--line,rgba(255,255,255,.08))}
.sr-foot textarea{flex:1;resize:none;min-height:42px;max-height:110px;padding:11px 12px;border-radius:14px;border:1px solid var(--line,rgba(255,255,255,.1));background:var(--surface-2,rgba(255,255,255,.04));color:var(--text,#E9EEF7);font:500 14px var(--font,system-ui);outline:none}
.sr-foot textarea:focus{border-color:#2F63A0;box-shadow:0 0 0 3px rgba(47,99,160,.25)}
.sr-send,.sr-mic{width:42px;height:42px;border-radius:13px;border:0;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:15px;flex-shrink:0}
.sr-send{background:#DCD60C;color:#0A1426}
.sr-send:disabled{opacity:.5;cursor:not-allowed}
.sr-mic{background:var(--surface-3,rgba(255,255,255,.07));color:var(--text,#E9EEF7)}
.sr-mic.rec{background:#FF5C6C;color:#fff;animation:pulse 1.4s infinite}
.sr-note{font-size:11px;color:var(--faint,#6A7C99);text-align:center;padding:0 12px 8px}
/* Bouche animée quand Sérafin parle */
.sr-talk{display:none}
.sr-speaking .sr-smile{display:none}
.sr-speaking .sr-talk{display:block;animation:srTalk .28s ease-in-out infinite alternate}
@keyframes srTalk{from{transform:scaleY(.4);transform-origin:60px 73.6px}to{transform:scaleY(1.1);transform-origin:60px 73.6px}}
.sr-eyes{animation:srBlink 5s infinite;transform-origin:60px 52px}
@keyframes srBlink{0%,94%,100%{transform:scaleY(1)}96%{transform:scaleY(.1)}}

/* Haut de page (comme Jàngi) */
#scrollTopBtn{position:fixed;right:31px;bottom:100px;z-index:9300;width:44px;height:44px;border-radius:50%;border:0;cursor:pointer;display:none;align-items:center;justify-content:center;font-size:15px;color:#0A1426;background:linear-gradient(135deg,#F0EA3A,#DCD60C);box-shadow:0 8px 22px rgba(220,214,12,.35);transition:transform .2s,box-shadow .2s;animation:srPop .25s ease-out}
#scrollTopBtn:hover{transform:translateY(-3px) scale(1.06);box-shadow:0 12px 28px rgba(220,214,12,.45)}
.sr-root.open~#scrollTopBtn{display:none!important}

@media (max-width:640px){
  .sr-root{--sr-r:14px;--sr-b:14px}
  .sr-launch{width:58px;height:58px}
  .sr-panel{position:fixed;left:10px;right:10px;bottom:84px;width:auto;height:calc(100vh - 110px);height:calc(100dvh - 110px)}
  .sr-teaser{right:68px}
  #scrollTopBtn{right:21px;bottom:84px;width:40px;height:40px}
}
@media (prefers-reduced-motion:reduce){.sr-launch,.sr-eyes{animation:none}}
body:has(.sr-root) .content{padding-bottom:110px}
body:has(.sr-root) #sc-toasts{bottom:100px}
