:where(.site-chat) {
  --sc-accent: #2563eb;
  --sc-on-accent: #ffffff;
  --sc-surface: #0f1522;
  --sc-surface-2: #182033;
  --sc-text: #eef2f8;
  --sc-muted: #9aa6b8;
  --sc-line: rgba(255, 255, 255, 0.1);
  --sc-font: inherit;
  --sc-radius: 18px;
  --sc-bot-head: #e3e9ef;
  --sc-bot-ear: #bcc7d2;
  --sc-bot-visor: #1d3550;
  --sc-bot-eye: #7fd0ff;
}

.site-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  font-family: var(--sc-font);
  color: var(--sc-text);
}

.site-chat *, .site-chat *::before, .site-chat *::after {
  box-sizing: border-box;
}

.sc-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sc-on-accent);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.sc-launcher::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--sc-accent);
  opacity: 0;
  animation: sc-pulse 2.6s cubic-bezier(0.22, 1, 0.36, 1) infinite;
  pointer-events: none;
}

.sc-launcher .sc-face {
  animation: sc-breathe 2.6s ease-in-out infinite;
}

.site-chat.is-open .sc-launcher::before, .site-chat.is-open .sc-launcher .sc-face {
  animation: none;
}

.sc-launcher:hover {
  transform: translateY(-2px) scale(1.05);
}

.sc-launcher:focus-visible, .sc-teaser:focus-visible {
  outline: 3px solid var(--sc-accent);
  outline-offset: 3px;
}

.sc-launcher svg {
  grid-area: 1 / 1;
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.sc-launcher .sc-face {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45));
}

.sc-bubble {
  fill: var(--sc-accent);
}

.sc-head {
  fill: var(--sc-bot-head);
}

.sc-ear {
  fill: var(--sc-bot-ear);
}

.sc-visor {
  fill: var(--sc-bot-visor);
}

.sc-eye {
  fill: var(--sc-bot-eye);
}

.sc-smile {
  fill: none;
  stroke: var(--sc-bot-eye);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.site-chat.is-open .sc-launcher {
  background: var(--sc-accent);
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.65);
}

.sc-launcher .sc-x {
  width: 26px;
  height: 26px;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.site-chat.is-open .sc-launcher .sc-face {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.site-chat.is-open .sc-launcher .sc-x {
  opacity: 1;
  transform: none;
}

.sc-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: sc-blink 5s infinite;
}

.sc-teaser {
  position: absolute;
  right: 80px;
  bottom: 10px;
  max-width: 280px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px 14px 4px 14px;
  background: var(--sc-surface);
  box-shadow: 0 0 0 1px var(--sc-line), 0 14px 30px -12px rgba(0, 0, 0, 0.6);
  color: var(--sc-text);
  font: 500 14px/1.35 var(--sc-font);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  animation: sc-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.sc-teaser[hidden], .site-chat.is-open .sc-teaser {
  display: none;
}

.sc-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 120px));
  border-radius: var(--sc-radius);
  background: var(--sc-surface);
  box-shadow: 0 0 0 1px var(--sc-line), 0 30px 70px -20px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  animation: sc-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sc-panel[hidden] {
  display: none;
}

.sc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 14px 16px;
  border-bottom: 1px solid var(--sc-line);
}

.sc-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
}

.sc-avatar svg {
  width: 40px;
  height: 40px;
}

.sc-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-right: auto;
  line-height: 1.25;
}

.sc-title b {
  font-size: 15px;
}

.sc-title small {
  font-size: 12px;
  color: var(--sc-muted);
}

.sc-reset, .sc-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sc-muted);
  cursor: pointer;
}

.sc-reset:hover, .sc-close:hover {
  background: var(--sc-surface-2);
  color: var(--sc-text);
}

.sc-reset svg, .sc-close svg {
  width: 18px;
  height: 18px;
}

.sc-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sc-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: sc-in 0.22s ease;
}

.sc-msg p {
  margin: 0;
}

.sc-msg p + p, .sc-msg p + ul, .sc-msg ul + p {
  margin-top: 6px;
}

.sc-msg ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.sc-msg li + li {
  margin-top: 2px;
}

.sc-msg a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sc-bot {
  align-self: flex-start;
  background: var(--sc-surface-2);
  border-bottom-left-radius: 4px;
}

.sc-user {
  align-self: flex-end;
  background: var(--sc-accent);
  color: var(--sc-on-accent);
  border-bottom-right-radius: 4px;
}

.sc-typing {
  display: flex;
  gap: 4px;
  padding: 13px 14px;
}

.sc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sc-muted);
  animation: sc-dot 1.2s infinite ease-in-out;
}

.sc-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.sc-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.sc-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}

.sc-options:empty {
  display: none;
}

.sc-options button {
  padding: 7px 12px;
  border: 1px solid var(--sc-line);
  border-radius: 999px;
  background: transparent;
  color: var(--sc-text);
  font: 500 13px var(--sc-font);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.sc-options button:hover:not(:disabled) {
  border-color: var(--sc-accent);
  background: var(--sc-surface-2);
}

.sc-options button:disabled {
  opacity: 0.5;
  cursor: default;
}

.sc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
  padding: 10px 12px 4px;
  border-top: 1px solid var(--sc-line);
}

.sc-form textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--sc-line);
  border-radius: 12px;
  background: var(--sc-surface-2);
  color: var(--sc-text);
  font: 14px/1.4 var(--sc-font);
  resize: none;
  outline: none;
}

.sc-form textarea:focus {
  border-color: var(--sc-accent);
}

.sc-form button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--sc-accent);
  color: var(--sc-on-accent);
  cursor: pointer;
  flex: none;
}

.sc-form button:disabled {
  opacity: 0.5;
  cursor: default;
}

.sc-form button svg {
  width: 18px;
  height: 18px;
}

.sc-count {
  min-height: 18px;
  margin: 0;
  padding: 0 16px 8px;
  font-size: 11px;
  color: var(--sc-muted);
  text-align: right;
}

@keyframes sc-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes sc-pulse {
  0% {
    opacity: 0.45;
    transform: scale(1);
  }

  70%, 100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes sc-breathe {
  0%, 100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

@keyframes sc-blink {
  0%, 92%, 100% {
    transform: none;
  }

  95% {
    transform: scaleY(0.1);
  }
}

@keyframes sc-dot {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 520px) {
  .site-chat {
    right: 12px;
    bottom: 12px;
  }

  .site-chat.is-open .sc-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .site-chat.is-open .sc-launcher {
    display: none;
  }

  .sc-teaser {
    max-width: calc(100vw - 110px);
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-chat * {
    animation: none !important;
    transition: none !important;
  }
}

.sc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font: 700 11px/1 var(--sc-font);
  box-shadow: 0 0 0 2px var(--sc-surface);
}

.sc-badge[hidden] {
  display: none;
}

.sc-nudge {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(300px, calc(100vw - 32px));
  animation: sc-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sc-nudge[hidden], .site-chat.is-open .sc-nudge {
  display: none;
}

.sc-nudge-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 14px 40px 14px 16px;
  border: 0;
  border-radius: 16px 16px 4px 16px;
  background: var(--sc-surface);
  box-shadow: 0 0 0 1px var(--sc-line), 0 18px 40px -14px rgba(0, 0, 0, 0.7);
  color: var(--sc-text);
  font: 14px/1.45 var(--sc-font);
  text-align: left;
  cursor: pointer;
}

.sc-nudge-body b {
  font-size: 13px;
  color: var(--sc-muted);
}

.sc-nudge-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sc-muted);
  cursor: pointer;
}

.sc-nudge-close:hover {
  background: var(--sc-surface-2);
  color: var(--sc-text);
}

.sc-nudge-close svg {
  width: 14px;
  height: 14px;
}

.sc-bell {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sc-muted);
  cursor: pointer;
}

.sc-bell:hover {
  background: var(--sc-surface-2);
  color: var(--sc-text);
}

.sc-bell svg {
  width: 18px;
  height: 18px;
}

.sc-bell-on, .site-chat.is-quiet .sc-bell-off {
  display: block;
}

.sc-bell-off, .site-chat.is-quiet .sc-bell-on {
  display: none;
}

.sc-ask .sc-nudge-body {
  padding-right: 16px;
  cursor: default;
}

.sc-ask-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.sc-ask-actions button {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  font: 600 13px/1 var(--sc-font);
  cursor: pointer;
}

.sc-ask-yes {
  background: var(--sc-accent);
  color: var(--sc-on-accent);
}

.sc-ask-no {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--sc-line);
  color: var(--sc-muted);
}

.sc-ask-actions button:hover {
  filter: brightness(1.08);
}

.sc-ask-actions button:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

/* A character image instead of the drawn robot (SiteChat:Avatar): it stands on its own, no circle behind it */
.site-chat.has-character .sc-launcher {
  width: 60px;
  height: 88px;
  border-radius: 30px;
}

.site-chat.has-character .sc-launcher::before {
  display: none;
}

.sc-character {
  display: block;
  width: 100%;
  height: 100%;
}

.sc-character img {
  display: block;
  width: auto;
  height: 100%;
  margin-inline: auto;
}

.sc-launcher .sc-character {
  grid-area: 1 / 1;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.4));
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Without an open look (SiteChat:AvatarOpen), the character gives way to the accent circle and its cross */
.site-chat.has-character:not(.morphs).is-open .sc-launcher {
  width: 64px;
  height: 64px;
}

.site-chat:not(.morphs).is-open .sc-launcher .sc-character {
  opacity: 0;
  transform: scale(0.6);
}

/* With one, the character itself (squashed into a ball) is the close button */
.site-chat.morphs.is-open .sc-launcher {
  background: transparent;
  box-shadow: none;
}

.site-chat.morphs .sc-launcher .sc-x {
  display: none;
}

.sc-avatar .sc-character {
  height: 44px;
}

/* The unread count sits on the character's shoulder, and the reply preview clears its head */
.site-chat.has-character .sc-badge {
  top: 6px;
  right: 0;
}

.site-chat.has-character .sc-nudge {
  bottom: 100px;
}

/* On phones the character stands smaller, so it covers less of the page */
@media (max-width: 720px) {
  .site-chat.has-character .sc-launcher {
    width: 46px;
    height: 68px;
  }

  .site-chat.has-character .sc-badge {
    top: 2px;
    right: -4px;
  }

  .site-chat.has-character .sc-nudge {
    bottom: 80px;
  }
}
