.poulpyx-chat,
.poulpyx-chat * {
  box-sizing: border-box;
}

.poulpyx-chat {
  position: fixed;
  bottom: 18px;
  z-index: 9999;
  width: 112px;
  height: 116px;
  color: #232436;
  font: 400 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
}

.poulpyx-chat--right {
  right: 18px;
}

.poulpyx-chat--left {
  left: 18px;
}

.poulpyx-chat--launcher-custom {
  width: 70px;
  height: 70px;
}

.poulpyx-chat__launcher {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  width: 112px;
  height: 116px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  transform-origin: 50% 100%;
  transition: transform .78s cubic-bezier(.2, .82, .24, 1), opacity .35s ease, filter .25s ease;
  -webkit-tap-highlight-color: transparent;
}

.poulpyx-chat--left .poulpyx-chat__launcher {
  right: auto;
  left: 0;
}

.poulpyx-chat--launcher-custom .poulpyx-chat__launcher {
  width: 70px;
  height: 70px;
}

.poulpyx-chat__launcher:focus-visible {
  border-radius: 28px;
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--poulpyx-color);
}

.poulpyx-chat__launcher:hover {
  filter: brightness(1.025);
}

.poulpyx-chat__custom-icon-shell {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  padding: 6px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 24px;
  background: var(--poulpyx-color);
  background: linear-gradient(145deg, color-mix(in srgb, var(--poulpyx-color) 88%, #fff), var(--poulpyx-color));
  box-shadow: 0 15px 36px rgba(31, 27, 71, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
  place-items: center;
  animation: poulpyx-custom-float 3.2s ease-in-out infinite;
}

.poulpyx-chat__custom-icon {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 17px;
  object-fit: contain;
}

.poulpyx-chat__notification {
  position: absolute;
  top: 10px;
  right: 3px;
  width: 13px;
  height: 13px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #36cf82;
  box-shadow: 0 2px 7px rgba(28, 126, 78, .35);
}

.poulpyx-chat--launcher-mascot .poulpyx-chat__notification {
  top: 17px;
  right: 8px;
}

.poulpyx-chat__nudge {
  position: absolute;
  right: 92px;
  bottom: 61px;
  width: max-content;
  max-width: min(230px, calc(100vw - 150px));
  opacity: 0;
  pointer-events: none;
  transform: translate(12px, 8px) scale(.94);
  transform-origin: right bottom;
  transition: opacity .25s ease, transform .38s cubic-bezier(.2, .8, .2, 1);
}

.poulpyx-chat--left .poulpyx-chat__nudge {
  right: auto;
  left: 92px;
  transform-origin: left bottom;
}

.poulpyx-chat__nudge span {
  position: relative;
  display: block;
  padding: 10px 14px;
  border: 1px solid rgba(95, 74, 176, .12);
  border-radius: 15px 15px 4px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 12px 34px rgba(34, 31, 64, .18);
  color: #38324f;
  font-size: 13px;
  font-weight: 650;
  white-space: normal;
}

.poulpyx-chat--left .poulpyx-chat__nudge span {
  border-radius: 15px 15px 15px 4px;
}

.poulpyx-chat--is-nudging .poulpyx-chat__nudge {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

.poulpyx-chat--is-hiding .poulpyx-chat__launcher {
  opacity: .82;
  transform: translateY(calc(100% + 34px)) rotate(7deg);
}

.poulpyx-chat--is-peeking .poulpyx-chat__launcher {
  transform: translateY(68px) rotate(-2deg);
}

.poulpyx-chat--is-peeking .poulpyx-mascot__tentacles,
.poulpyx-chat--is-peeking .poulpyx-mascot__floor-shadow {
  opacity: 0;
}

.poulpyx-chat--is-swimming .poulpyx-chat__notification,
.poulpyx-chat--is-peeking .poulpyx-chat__notification,
.poulpyx-chat--is-hiding .poulpyx-chat__notification {
  opacity: 0;
}

.poulpyx-chat--is-thinking .poulpyx-chat__custom-icon-shell {
  animation: poulpyx-custom-thinking .85s ease-in-out infinite;
}

.poulpyx-chat--is-happy .poulpyx-chat__custom-icon-shell {
  animation: poulpyx-custom-happy .58s ease-in-out 2;
}

.poulpyx-chat--is-error .poulpyx-chat__custom-icon-shell {
  animation: poulpyx-custom-error .42s ease-in-out 2;
}

.poulpyx-chat__panel {
  position: absolute;
  right: 0;
  bottom: 120px;
  display: flex;
  width: min(396px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 150px));
  min-height: 390px;
  overflow: hidden;
  border: 1px solid rgba(102, 87, 162, .14);
  border-radius: 25px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 28px 75px rgba(32, 29, 62, .24), 0 5px 18px rgba(32, 29, 62, .11);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.965);
  transform-origin: right bottom;
  transition: opacity .22s ease, transform .3s cubic-bezier(.2, .84, .25, 1);
  flex-direction: column;
  backdrop-filter: blur(18px);
}

.poulpyx-chat--left .poulpyx-chat__panel {
  right: auto;
  left: 0;
  transform-origin: left bottom;
}

.poulpyx-chat--launcher-custom .poulpyx-chat__panel {
  bottom: 82px;
}

.poulpyx-chat__panel[hidden] {
  display: none;
}

.poulpyx-chat--is-open .poulpyx-chat__panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.poulpyx-chat__header {
  position: relative;
  display: flex;
  min-height: 92px;
  padding: 18px 18px 17px 20px;
  overflow: hidden;
  background: var(--poulpyx-color);
  background: linear-gradient(135deg, color-mix(in srgb, var(--poulpyx-color) 89%, #fff), var(--poulpyx-color));
  color: #fff;
  align-items: flex-start;
  justify-content: space-between;
}

.poulpyx-chat__header::after {
  position: absolute;
  right: -24px;
  bottom: -45px;
  width: 145px;
  height: 145px;
  border: 25px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  content: "";
}

.poulpyx-chat__identity {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.poulpyx-chat__status {
  width: 11px;
  height: 11px;
  margin-top: 8px;
  border: 2px solid rgba(255, 255, 255, .75);
  border-radius: 50%;
  background: #4ee59a;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .12);
  flex: 0 0 auto;
}

.poulpyx-chat__eyebrow {
  display: block;
  margin-bottom: 1px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  opacity: .76;
  text-transform: uppercase;
}

.poulpyx-chat__header strong {
  display: block;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.015em;
}

.poulpyx-chat__header p {
  max-width: 280px;
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.35;
  opacity: .87;
}

.poulpyx-chat__header-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.poulpyx-chat__reset,
.poulpyx-chat__close {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  place-items: center;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.poulpyx-chat__reset {
  font: 500 21px/1 system-ui, sans-serif;
}

.poulpyx-chat__close {
  padding-bottom: 3px;
  font: 300 27px/1 system-ui, sans-serif;
}

.poulpyx-chat__reset:hover,
.poulpyx-chat__reset:focus-visible,
.poulpyx-chat__close:hover,
.poulpyx-chat__close:focus-visible {
  background: rgba(255, 255, 255, .22);
}

.poulpyx-chat__reset:hover,
.poulpyx-chat__reset:focus-visible {
  transform: rotate(-18deg);
}

.poulpyx-chat__close:hover,
.poulpyx-chat__close:focus-visible {
  transform: rotate(4deg);
}

.poulpyx-chat__messages {
  min-height: 0;
  padding: 20px 18px 10px;
  overflow: auto;
  background:
    radial-gradient(circle at 15% 4%, color-mix(in srgb, var(--poulpyx-color) 8%, transparent), transparent 35%),
    #f8f8fc;
  scroll-behavior: smooth;
  flex: 1 1 auto;
}

.poulpyx-chat__message {
  position: relative;
  width: fit-content;
  max-width: 86%;
  margin: 0 0 13px;
  padding: 11px 14px;
  border-radius: 7px 17px 17px;
  font-size: 14px;
  line-height: 1.48;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  animation: poulpyx-message-in .28s ease both;
}

.poulpyx-chat__message--assistant {
  border: 1px solid rgba(91, 74, 154, .12);
  background: #fff;
  box-shadow: 0 7px 20px rgba(43, 38, 73, .07);
  color: #36334a;
}

.poulpyx-chat__message--user {
  margin-left: auto;
  border-radius: 17px 7px 17px 17px;
  background: var(--poulpyx-color);
  background: linear-gradient(135deg, color-mix(in srgb, var(--poulpyx-color) 88%, #fff), var(--poulpyx-color));
  box-shadow: 0 7px 20px color-mix(in srgb, var(--poulpyx-color) 18%, transparent);
  color: #fff;
}

.poulpyx-chat__message--error {
  border-color: #f2b9b9;
  background: #fff5f5;
  color: #9b1c1c;
}

.poulpyx-chat__message a {
  color: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.poulpyx-chat__form {
  display: flex;
  gap: 9px;
  padding: 13px 14px 14px;
  border-top: 1px solid rgba(77, 67, 119, .1);
  background: #fff;
  align-items: flex-end;
}

.poulpyx-chat__form textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 13px;
  overflow-y: auto;
  border: 1px solid #d9d8e5;
  border-radius: 14px;
  outline: 0;
  background: #fbfbfd;
  color: #29273a;
  font: inherit;
  line-height: 1.4;
  resize: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.poulpyx-chat__form textarea:focus {
  border-color: color-mix(in srgb, var(--poulpyx-color) 58%, #fff);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--poulpyx-color) 10%, transparent);
}

.poulpyx-chat__form button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--poulpyx-color);
  background: linear-gradient(145deg, color-mix(in srgb, var(--poulpyx-color) 83%, #fff), var(--poulpyx-color));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--poulpyx-color) 25%, transparent);
  color: #fff;
  place-items: center;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
  flex: 0 0 auto;
}

.poulpyx-chat__form button svg {
  width: 21px;
  height: 21px;
}

.poulpyx-chat__form button:hover,
.poulpyx-chat__form button:focus-visible {
  box-shadow: 0 10px 22px color-mix(in srgb, var(--poulpyx-color) 34%, transparent);
  transform: translateY(-2px);
}

.poulpyx-chat__form.is-loading button {
  opacity: .5;
  cursor: wait;
  transform: none;
}

.poulpyx-chat--embedded {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: auto;
  display: block;
  width: 100%;
  height: auto;
  min-height: 520px;
  pointer-events: auto;
}

.poulpyx-chat--embedded .poulpyx-chat__panel {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  width: 100%;
  max-width: 880px;
  height: clamp(520px, 70vh, 720px);
  min-height: 520px;
  margin: 0 auto;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transform-origin: center;
}

@keyframes poulpyx-custom-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-5px) rotate(1deg); }
}

@keyframes poulpyx-message-in {
  from { opacity: 0; transform: translateY(7px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes poulpyx-custom-thinking {
  0%, 100% { transform: translateY(-2px) scale(.98); }
  50% { transform: translateY(-5px) scale(1.04); }
}

@keyframes poulpyx-custom-happy {
  0%, 100% { transform: translateY(0) rotate(0); }
  45% { transform: translateY(-7px) rotate(-4deg); }
  75% { transform: translateY(-3px) rotate(4deg); }
}

@keyframes poulpyx-custom-error {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(-4px); }
  66% { transform: translateX(4px); }
}

@media (max-width: 520px) {
  .poulpyx-chat {
    right: 10px;
    bottom: 8px;
  }

  .poulpyx-chat--left {
    right: auto;
    left: 10px;
  }

  .poulpyx-chat__panel,
  .poulpyx-chat--launcher-custom .poulpyx-chat__panel {
    position: fixed;
    right: 10px;
    bottom: 94px;
    left: 10px;
    width: auto;
    height: min(650px, calc(100dvh - 112px));
    min-height: 330px;
    transform-origin: center bottom;
  }

  .poulpyx-chat--left .poulpyx-chat__panel {
    right: 10px;
    left: 10px;
  }

  .poulpyx-chat__nudge {
    right: 88px;
    bottom: 64px;
    max-width: calc(100vw - 125px);
  }

  .poulpyx-chat--left .poulpyx-chat__nudge {
    right: auto;
    left: 88px;
  }

  .poulpyx-chat--embedded {
    right: auto;
    bottom: auto;
    left: auto;
    min-height: 480px;
  }

  .poulpyx-chat--embedded .poulpyx-chat__panel {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    height: min(650px, 72dvh);
    min-height: 480px;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .poulpyx-chat__launcher,
  .poulpyx-chat__panel,
  .poulpyx-chat__nudge,
  .poulpyx-chat__custom-icon-shell,
  .poulpyx-chat__message {
    animation: none !important;
    scroll-behavior: auto;
    transition-duration: .01ms !important;
  }
}
