.chat-launcher{position:fixed;right:22px;bottom:22px;z-index:100;background:#914458;color:#fff;border:0;border-radius:50px;padding:14px 19px;box-shadow:0 10px 30px #54273544;font-weight:800}.chat-window{position:fixed;right:22px;bottom:83px;z-index:101;width:min(380px,calc(100vw - 28px));max-height:min(610px,calc(100dvh - 100px));display:flex;flex-direction:column;border-radius:22px;background:#fff;box-shadow:0 20px 65px #1b1c2b40;border:1px solid #eadfe2;overflow:hidden}.chat-window[hidden]{display:none}.chat-header{display:flex;align-items:center;gap:12px;padding:14px;background:#914458;color:#fff}.chat-header img{width:46px;height:46px;border-radius:50%;background:#fff;object-fit:cover}.chat-header strong{font-size:14px}.chat-header small{display:block;font-size:11px;opacity:.9}.chat-close{margin-left:auto;border:0;background:transparent;color:#fff;font-size:27px}.chat-messages{padding:15px;display:flex;flex-direction:column;gap:9px;min-height:125px;overflow-y:auto}.chat-bubble{padding:10px 13px;border-radius:14px;max-width:90%;font-size:13px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}.chat-bubble.bot{background:#f9eef0;align-self:flex-start}.chat-bubble.user{background:#914458;color:#fff;align-self:flex-end}.chat-options{padding:4px 14px 10px;display:flex;flex-wrap:wrap;gap:7px}.chat-options button{font-size:12px;color:#914458;border:1px solid #e5cad1;border-radius:20px;padding:7px 10px;background:#fff}.chat-form{display:flex;gap:8px;padding:10px 14px;border-top:1px solid #eadfe2}.chat-form input{flex:1;min-width:0;padding:10px;border:1px solid #d8cdd1;border-radius:10px;font:inherit;font-size:13px}.chat-form button{background:#914458;color:white;border:0;border-radius:10px;padding:10px;font-weight:700}.chat-warning{padding:0 14px 12px;margin:0;color:#647084;font-size:10px}.chat-contact{padding:0 14px 12px;font-size:12px;color:#914458;font-weight:800}.chat-contact[hidden]{display:none}@media(max-width:440px){.chat-launcher{right:12px;bottom:12px}.chat-window{right:12px;bottom:70px}}

/* Thay v2: microinterações discretas, respeitando preferências de movimento */
.chat-header .chat-avatar{width:50px;height:50px;flex:0 0 50px;border-radius:50%;background:#fff;overflow:hidden;display:grid;place-items:center;border:2px solid #ffffff88}
.chat-header .chat-avatar img{width:100%;height:100%;object-fit:cover;transform-origin:50% 85%}
.chat-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 14px 12px;flex-wrap:wrap}
.chat-restart{background:transparent;border:0;text-decoration:underline;color:#914458;font-size:12px;padding:5px;cursor:pointer}
.chat-footer .chat-contact{padding:8px 10px;background:#edf8f0;color:#166534;border-radius:9px;text-decoration:none;font-size:12px}
.chat-options{max-height:168px;overflow:auto;flex-shrink:0}
.chat-messages{min-height:95px;max-height:270px;flex:1}
.chat-header .chat-close,.chat-options button,.chat-launcher,.chat-form button{cursor:pointer}
.chat-window button:focus-visible,.chat-launcher:focus-visible,.chat-contact:focus-visible{outline:3px solid #2563eb;outline-offset:3px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(prefers-reduced-motion:no-preference){
 .chat-launcher{animation:thay-float 4s ease-in-out infinite}
 .chat-avatar[data-mood="welcome"] img{animation:thay-wave 1.4s ease-in-out 1}
 .chat-avatar[data-mood="happy"] img{animation:thay-happy .55s ease-in-out 1}
 .chat-avatar[data-mood="explaining"] img{animation:thay-explain .6s ease-in-out 1}
 .chat-window:not([hidden]){animation:thay-appear .22s ease-out}
}
@keyframes thay-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}
@keyframes thay-wave{0%,100%{transform:rotate(0)}35%{transform:rotate(5deg)}65%{transform:rotate(-4deg)}}
@keyframes thay-happy{0%,100%{transform:scale(1)}45%{transform:scale(1.10)}}
@keyframes thay-explain{0%,100%{transform:rotate(0)}50%{transform:rotate(-4deg)}}
@keyframes thay-appear{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}

.chat-pose-wrap{height:88px;display:flex;justify-content:flex-end;align-items:flex-end;overflow:hidden;padding:0 24px;background:linear-gradient(90deg,transparent,#fff2f4)}
.chat-pose{height:155px;max-width:140px;object-fit:contain;object-position:bottom;animation:thay-hello .6s ease both}
.chat-avatar[data-mood="explaining"] img{transform:scale(1.08)}
.chat-avatar[data-mood="happy"] img{transform:rotate(-3deg) scale(1.06)}
@keyframes thay-hello{from{opacity:.3;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@media(max-height:720px){.chat-pose-wrap{height:45px}.chat-pose{height:90px}}
@media(prefers-reduced-motion:reduce){.chat-pose{animation:none}}

/* Fase 4: linguagem visual dos estados da personagem */
.chat-pose-wrap{position:relative;min-height:98px;justify-content:flex-end;background:linear-gradient(105deg,#fff,#fff2f5 65%,#fbe4e9)}
.chat-stage{position:absolute;left:18px;top:22px;padding:9px 13px;border:1px solid #edcdd6;background:#fff;border-radius:20px;color:#914458;font-size:12px;font-weight:800;box-shadow:0 4px 12px #91445814}
.chat-stage:after{content:'';position:absolute;right:-5px;bottom:10px;width:9px;height:9px;transform:rotate(45deg);background:white;border-top:1px solid #edcdd6;border-right:1px solid #edcdd6}
.chat-pose{height:168px;max-width:150px;transition:opacity .2s ease,transform .2s ease}
.chat-pose-enter{animation:thay-pose-enter .45s ease-out both}
@keyframes thay-pose-enter{from{opacity:0;transform:translateX(14px) scale(.96)}to{opacity:1;transform:translateX(0) scale(1)}}
.chat-window[data-stage="happy"] .chat-pose-wrap{background:linear-gradient(105deg,#fff,#f2faf3)}
.chat-window[data-stage="happy"] .chat-stage{border-color:#b8dfc2;color:#176b3b}
.chat-window[data-stage="happy"] .chat-stage:after{border-color:#b8dfc2}
.chat-options button:hover{background:#fff1f4;border-color:#bd8190}
.chat-options button:active{transform:scale(.98)}
@media(max-width:440px){.chat-pose-wrap{min-height:80px}.chat-pose{height:135px}.chat-stage{top:16px;left:12px}}
@media(prefers-reduced-motion:reduce){.chat-pose-enter{animation:none}.chat-options button:active{transform:none}}

/* Fase 5: painel compacto, responsivo e acessível */
.chat-launcher{display:inline-flex;align-items:center;gap:8px;min-height:48px;box-sizing:border-box}
.chat-launcher::before{content:"";width:9px;height:9px;background:#b8f3ce;border-radius:50%;box-shadow:0 0 0 3px #ffffff30}
.chat-window{width:min(420px,calc(100vw - 28px));max-height:min(690px,calc(100dvh - 104px));box-sizing:border-box}
.chat-header{background:linear-gradient(110deg,#9e5266,#bf6d7e);flex-shrink:0}
.chat-header strong{font-size:15px}
.chat-header small{font-size:12px}
.chat-messages{min-height:70px;max-height:none;overscroll-behavior:contain}
.chat-bubble{font-size:13.5px}
.chat-options{max-height:145px;padding-block:9px;gap:8px}
.chat-options button{min-height:36px;padding:8px 12px;text-align:left}
.chat-pose-wrap{height:105px;min-height:105px;flex-shrink:0}
.chat-pose{height:174px;max-width:155px}
.chat-form{flex-shrink:0;background:#fff}
.chat-form input{min-height:43px}
.chat-form button{min-width:64px}
.chat-warning{font-size:11px;line-height:1.45;padding-bottom:7px}
.chat-footer{flex-shrink:0;padding-bottom:10px}
.chat-window .chat-close{width:40px;height:40px;flex-shrink:0;border-radius:12px}
.chat-window .chat-close:hover{background:#ffffff22}
@media(max-width:600px){
 .chat-launcher{right:12px;bottom:max(12px,env(safe-area-inset-bottom));padding:12px 16px}
 .chat-window{right:0;bottom:0;width:100%;max-height:none;height:min(740px,100dvh);border-radius:20px 20px 0 0;border-left:0;border-right:0;border-bottom:0;padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -15px 50px #1b1c2b44}
 .chat-header{padding:13px 16px}
 .chat-pose-wrap{height:90px;min-height:90px}
 .chat-pose{height:145px}
 .chat-messages{padding:12px 16px}
 .chat-options{padding:8px 16px;max-height:150px}
 .chat-options button{flex:1 1 calc(50% - 8px)}
 .chat-form{padding:9px 12px}
 .chat-warning{padding-inline:16px}
 .chat-footer{padding-inline:16px}
}
@media(max-width:370px){
 .chat-header strong{font-size:13px}
 .chat-header small{font-size:10px}
 .chat-options button{flex-basis:100%}
 .chat-pose-wrap{height:65px;min-height:65px}
 .chat-pose{height:115px}
}
@media(max-height:620px) and (min-width:601px){
 .chat-window{max-height:calc(100dvh - 92px)}
 .chat-pose-wrap{height:52px;min-height:52px}
 .chat-pose{height:96px}
 .chat-options{max-height:100px}
}

@media(max-width:600px){body.thay-open{overflow:hidden}}

/* Etapa 3 — personagem integral, sem recorte vertical */
.chat-pose-wrap{
  box-sizing:border-box;
  height:142px;
  min-height:142px;
  padding:8px 20px 0;
  align-items:center;
  overflow:hidden;
}
.chat-pose{
  display:block;
  width:auto;
  height:100%;
  max-width:48%;
  object-fit:contain;
  object-position:center bottom;
  flex-shrink:0;
}
.chat-stage{z-index:1;max-width:48%;box-sizing:border-box}
@media(max-width:600px){
  .chat-pose-wrap{height:124px;min-height:124px;padding:6px 14px 0}
  .chat-pose{max-width:48%}
}
@media(max-width:370px){
  .chat-pose-wrap{height:108px;min-height:108px}
}
@media(max-height:620px) and (min-width:601px){
  .chat-pose-wrap{height:90px;min-height:90px}
}
