#sac-root {
  --sac-primary: #0f5db8;
  --sac-accent: #22a8c8;
  --sac-panel-bg: #f7f7f7;
  --sac-bot-bubble: #e9eaee;
  --sac-user-bubble: #0f5db8;
  --sac-text: #2b2d33;
  --sac-bottom: 24px;
  --sac-right: 24px;
  --sac-tip-gap: 14px;
  --sac-close-size: 18px;
  --sac-close-bg: #16a3c8;
  --sac-close-bg-hover: #0f5db8;
  --sac-close-icon: #ffffff;
  --sac-close-icon-hover: #ffffff;
  --sac-user-bubble-radius: 10px 10px 0 10px;
  --sac-head-bg: #ffffff;
  position: fixed;
  right: var(--sac-right);
  bottom: var(--sac-bottom);
  z-index: 999999;
  width: 320px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--sac-text);
}

#sac-root *,
#sac-root *::before,
#sac-root *::after {
  box-sizing: border-box;
}

#sac-root button,
#sac-root input {
  font: inherit;
}

.sac-dock {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sac-tip-gap);
  min-height: 72px;
}

.sac-head,
.sac-tip-close,
.sac-close,
.sac-voice,
.sac-choice {
  -webkit-appearance: none;
  appearance: none;
}

.sac-head {
  position: relative;
  z-index: 3;
  width: 62px;
  height: 62px;
  min-width: 62px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--sac-head-bg);
  box-shadow: 0 10px 20px rgba(0, 0, 0, .16);
  overflow: hidden;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sac-head-image,
.sac-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  display: block;
}

.sac-head-fallback,
.sac-avatar span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--sac-primary);
  font-size: 28px;
  font-weight: 700;
}

.sac-tip-card {
  position: relative;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 206px;
  margin-right: 0;
  padding: 18px 24px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .16);
  animation: sacFloat 2.8s ease-in-out infinite;
}

.sac-tip-card::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -5px;
  width: 22px;
  height: 22px;
  background: #fff;
  transform: translateY(-50%) rotate(45deg);
  border-radius: 2px;
}

.sac-tip-collapsed {
  display: none;
}

.sac-tip-label {
  display: block;
  color: #60636a;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.sac-tip-close,
.sac-close {
  border: 0;
  border-radius: 999px;
  background: var(--sac-close-bg);
  color: var(--sac-close-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.sac-tip-close:hover,
.sac-tip-close:focus-visible,
.sac-close:hover,
.sac-close:focus-visible {
  background: var(--sac-close-bg-hover);
  color: var(--sac-close-icon-hover);
}

.sac-tip-close {
  position: absolute;
  top: calc(var(--sac-close-size) * -0.44);
  left: calc(var(--sac-close-size) * -0.44);
  width: var(--sac-close-size);
  height: var(--sac-close-size);
  padding: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
}

.sac-tip-close span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: calc(var(--sac-close-size) * .72);
  line-height: 1;
}

.sac-open .sac-dock {
  display: none;
}

.sac-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 320px;
  height: 500px;
  overflow: hidden;
  border-radius: 22px 22px 0 0;
  background: var(--sac-panel-bg);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .18);
}

.sac-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
}

.sac-panel-header {
  position: relative;
  min-height: 76px;
  padding: 18px 20px 14px;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.sac-panel-title-wrap strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #252930;
}

.sac-panel-subtitle {
  margin-top: 6px;
  font-size: 12px;
  color: #858991;
}

.sac-messages {
  position: absolute;
  top: 76px;
  left: 0;
  right: 0;
  bottom: 88px;
  overflow-y: auto;
  padding: 18px 14px 8px;
}

.sac-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.sac-row-user {
  justify-content: flex-end;
}

.sac-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.sac-bubble {
  max-width: 220px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.35;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}

.sac-bubble-bot {
  border-radius: 10px;
  background: var(--sac-bot-bubble);
  color: #3b4048;
}

.sac-bubble-user {
  border-radius: var(--sac-user-bubble-radius);
  background: var(--sac-user-bubble);
  color: #fff;
}

.sac-row-options {
  align-items: flex-start;
}

.sac-options-bubble {
  max-width: 240px;
  padding: 10px;
  border-radius: 14px;
  background: var(--sac-bot-bubble);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sac-choices {
  display: contents;
}

.sac-choice {
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--sac-primary);
  padding: 9px 13px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  white-space: normal;
  max-width: 100%;
  box-shadow: 0 1px 1px rgba(0,0,0,.05);
}

.sac-input-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 18px 18px;
  background: transparent;
}

.sac-input-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 0 14px 0 18px;
  border: 1.5px solid #10a6d3;
  border-radius: 999px;
  background: #f6f6f7;
}

#sac-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #676b73;
  font-size: 16px;
  outline: none;
  box-shadow: none;
}

#sac-input::placeholder {
  color: #8c8f96;
}

.sac-voice {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8c8f96;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sac-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sac-typing span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #a4a8b0;
  animation: sacPulse 1.2s infinite ease-in-out;
}

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

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

@keyframes sacPulse {
  0%, 80%, 100% { opacity: .28; transform: scale(.85); }
  40% { opacity: 1; transform: scale(1); }
}

@keyframes sacFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@media (max-width: 480px) {
  #sac-root {
    right: 14px;
    bottom: 14px;
    width: min(320px, calc(100vw - 28px));
  }

  .sac-panel {
    width: min(320px, calc(100vw - 28px));
    height: min(500px, calc(100vh - 28px));
    border-radius: 22px;
  }

  .sac-tip-card {
    min-width: 170px;
    max-width: calc(100vw - 120px);
  }
}
