.msh-whale {
  --msh-blue: #4e93c8;
  --msh-dark: #2f6fae;
  --msh-coral: #ff9f6b;
  --msh-sky: #eaf8ff;
  --msh-text: #334155;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99990;
  font-family: Nunito Sans, sans-serif;
  color: var(--msh-text);
}

.msh-whale .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.msh-whale__fab {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: #fff;
  color: var(--msh-dark);
  border-radius: 999px;
  padding: 8px 14px 8px 8px;
  box-shadow: 0 8px 24px rgba(47, 111, 174, 0.22);
  cursor: pointer;
  font: 700 14px/1 Quicksand, sans-serif;
}

.msh-whale.is-open .msh-whale__fab {
  display: none;
}

.msh-whale__canvas,
.msh-whale__fallback {
  width: 72px;
  height: 72px;
  display: block;
  border-radius: 50%;
  background: var(--msh-sky);
}

.msh-whale__canvas[hidden],
.msh-whale__fallback[hidden] {
  display: none;
}

.msh-whale__panel {
  display: none !important;
  width: min(360px, calc(100vw - 24px));
  max-height: min(72vh, 560px);
  flex-direction: column;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(47, 111, 174, 0.28);
  overflow: hidden;
}

.msh-whale.is-open .msh-whale__panel {
  display: flex !important;
}

.msh-whale__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--msh-blue);
  color: #fff;
}

.msh-whale__head-title {
  margin: 0;
  font: 700 16px/1 Quicksand, sans-serif;
}

.msh-whale__close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.msh-whale__log {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}

.msh-whale__msg {
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.45;
}

.msh-whale__msg--bot {
  align-self: flex-start;
  background: var(--msh-sky);
}

.msh-whale__msg--user {
  align-self: flex-end;
  background: var(--msh-blue);
  color: #fff;
}

.msh-whale__msg a {
  color: var(--msh-dark);
  font-weight: 700;
}

.msh-whale__links {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.msh-whale__hint {
  margin: 0;
  padding: 0 14px 8px;
  font-size: 12px;
  color: #64748b;
}

.msh-whale__form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid #eaf8ff;
}

.msh-whale__form input {
  flex: 1;
  border: 2px solid var(--msh-blue);
  border-radius: 16px;
  padding: 10px 12px;
  font: inherit;
}

.msh-whale__form button {
  border: 0;
  border-radius: 16px;
  background: var(--msh-coral);
  color: #fff;
  font: 700 14px/1 Quicksand, sans-serif;
  padding: 0 14px;
  cursor: pointer;
}

.msh-whale__form button:disabled {
  opacity: 0.6;
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .msh-whale {
    right: 0;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    transform: translate3d(30px, 0, 0);
  }

  .msh-whale__label {
    display: none;
  }

  .msh-whale__canvas,
  .msh-whale__fallback {
    width: 44px;
    height: 44px;
  }

  .msh-whale__fab {
    padding: 4px 2px 4px 6px;
    border-radius: 22px 0 0 22px;
    box-shadow: -2px 6px 16px rgba(47, 111, 174, 0.2);
    transition: transform 0.28s ease, opacity 0.28s ease;
  }

  .msh-whale.is-tucked:not(.is-open) {
    transform: translate3d(30px, 140%, 0);
    pointer-events: none;
  }

  .msh-whale.is-open {
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
    pointer-events: auto;
  }

  .msh-whale.is-open .msh-whale__panel {
    width: 100%;
    max-height: min(78dvh, 560px);
  }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .msh-whale__fab,
  .msh-whale.is-tucked:not(.is-open) {
    transition: none;
  }
}
