.espero-chat { --chat-blue: #1455ed; position: fixed; z-index: 1000; right: max(20px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); font-family: Inter, Arial, sans-serif; color: #15171c; font-size: 14px; line-height: 1.5; }
.espero-chat *, .espero-chat *::before, .espero-chat *::after { box-sizing: border-box; }
.espero-chat button, .espero-chat textarea { font: inherit; }
.espero-chat button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.espero-chat button:focus-visible, .espero-chat textarea:focus-visible { outline: 3px solid #83acff; outline-offset: 4px; }
.espero-chat [hidden] { display: none !important; }
.espero-chat__launcher { display: block; position: relative; width: 64px; height: 64px; margin-left: auto; padding: 0; border: 0; background: transparent; border-radius: 16px; }
.espero-chat__head { position: absolute; width: 88px; height: 88px; max-width: none; inset: -12px; pointer-events: none; filter: drop-shadow(0 4px 4px #11214424); }
.espero-chat__head-video { visibility: hidden; }
.espero-chat__launcher.is-animating .espero-chat__head-video.is-current { visibility: visible; }
.espero-chat__launcher.is-animating > img { visibility: hidden; }
.espero-chat__sleep { position: absolute; top: -14px; right: 3px; pointer-events: none; opacity: 0; transition: opacity 180ms; }
.espero-chat__sleep span { position: absolute; color: #67738c; font-weight: 600; font-size: 13px; animation: espero-sleep 2.4s linear infinite paused; }
.espero-chat__sleep span:nth-child(2) { animation-delay: -.8s; font-size: 17px; }
.espero-chat__sleep span:nth-child(3) { animation-delay: -1.6s; font-size: 14px; }
.espero-chat__launcher.is-sleeping .espero-chat__sleep { opacity: 1; }
.espero-chat__launcher.is-sleeping .espero-chat__sleep span { animation-play-state: running; }
@keyframes espero-sleep { 0% { transform: translate(-10px, 8px) scale(.75); opacity: 0; } 20% { opacity: .85; } 100% { transform: translate(12px, -28px) scale(1.1); opacity: 0; } }
.espero-chat__panel { position: absolute; width: 360px; height: min(510px, calc(100dvh - 120px)); right: 0; bottom: 84px; display: flex; flex-direction: column; background: white; border: 1px solid #e2e5ec; border-radius: 17px; box-shadow: 0 14px 50px #15264b20, 0 3px 10px #15264b0a; transform-origin: calc(100% - 32px) bottom; animation: espero-chat-open 180ms ease-out; }
.espero-chat__panel::after { content: ''; position: absolute; right: 22px; bottom: -9px; width: 17px; height: 17px; background: white; border-right: 1px solid #e2e5ec; border-bottom: 1px solid #e2e5ec; transform: rotate(45deg); }
@keyframes espero-chat-open { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.espero-chat__header { display: flex; align-items: center; gap: 10px; min-height: 68px; padding: 12px 16px; border-radius: 16px 16px 0 0; background: var(--chat-blue); color: #fff; }
.espero-chat__avatar { width: 34px; height: 34px; object-fit: cover; transform: scale(1.4); margin-right: 2px; }
.espero-chat__title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.3px; }
.espero-chat__close { margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; color: #fff; border: 0; background: transparent; border-radius: 50%; }
.espero-chat__close:hover { background: #ffffff1a; }
.espero-chat__close svg { width: 22px; height: 22px; }
.espero-chat__messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 18px 12px; scrollbar-width: thin; }
.espero-chat__day { display: flex; align-items: center; gap: 14px; color: #7e8697; font-size: 12px; margin-bottom: 22px; }
.espero-chat__day::before, .espero-chat__day::after { content: ''; height: 1px; flex: 1; background: #e9ecf2; }
.espero-chat__message { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 18px; }
.espero-chat__message p { max-width: 88%; margin: 0; padding: 11px 14px; background: #f0f1f5; border-radius: 16px 16px 16px 4px; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
.espero-chat__message time { margin-top: 5px; font-size: 11px; color: #858b99; }
.espero-chat__message--user { align-items: flex-end; }
.espero-chat__message--user p { background: var(--chat-blue); color: white; border-radius: 16px 16px 4px 16px; }
.espero-chat__form { margin: 0; padding: 8px 16px 15px; }
.espero-chat__input-wrap { display: flex; align-items: flex-end; gap: 8px; min-height: 72px; padding: 9px; border: 1px solid #c9cfdd; border-radius: 22px; }
.espero-chat__input-wrap:focus-within { border-color: var(--chat-blue); box-shadow: 0 0 0 2px #1455ed0d; }
.espero-chat__input { display: block; flex: 1; min-width: 0; height: 50px; padding: 4px 2px 4px 5px; resize: none; border: 0; background: transparent; color: #15171c; font-size: 14px; line-height: 21px; }
.espero-chat__input::placeholder { color: #8a92a4; }
.espero-chat .espero-chat__input:focus-visible { outline: none; }
.espero-chat__send { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--chat-blue); color: white; }
.espero-chat__send:disabled { opacity: .45; cursor: default; }
.espero-chat__send svg { width: 23px; height: 23px; }
.espero-chat__status { margin: 8px 4px 0; color: #7c8495; font-size: 10px; line-height: 1.4; }
.espero-chat__sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 480px) {
  .espero-chat { right: max(12px, env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); }
  .espero-chat__panel { width: calc(100vw - 24px); max-width: 360px; height: min(510px, calc(100dvh - 110px)); bottom: 80px; }
  .espero-chat__input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .espero-chat__panel { animation: none; }
  .espero-chat__sleep { display: none; }
}

.espero-chat__message p { white-space: pre-wrap; overflow-wrap: anywhere; }

.espero-chat__message a { color: #1455ed; text-decoration: underline; text-underline-offset: 2px; }
.espero-chat__message a:hover { text-decoration-thickness: 2px; }
.espero-chat__message a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
