.assistant-widget {
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: #272932;
}

.assistant-launcher {
  --launcher-size: clamp(64px, calc(var(--logo-width) * 0.4), 136px);
  position: fixed;
  z-index: 60;
  left: calc(var(--margin) + var(--logo-width) + 12px);
  top: var(--margin);
  display: grid;
  place-items: center;
  width: var(--launcher-size);
  height: var(--launcher-size);
  padding: 12px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.assistant-launcher:hover img,
.assistant-launcher[aria-expanded="true"] img {
  filter: drop-shadow(0 6px 10px #5044a866);
}

.assistant-launcher.is-dragging {
  cursor: grabbing;
}

.assistant-launcher img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 7px #32285759);
  transition: filter 0.2s;
}

.assistant-hint {
  position: fixed;
  z-index: 60;
  width: min(300px, calc(100vw - 24px));
  padding: 14px 42px 14px 16px;
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 24px #00000014;
  color: #000;
  font-size: 14px;
  line-height: 1.7;
}

.assistant-hint::before {
  content: "";
  position: absolute;
  border: 8px solid transparent;
  pointer-events: none;
}

.assistant-hint[data-side="right"]::before {
  right: 100%;
  top: var(--hint-tail);
  border-right-color: #fff;
  transform: translateY(-50%);
}

.assistant-hint[data-side="left"]::before {
  left: 100%;
  top: var(--hint-tail);
  border-left-color: #fff;
  transform: translateY(-50%);
}

.assistant-hint[data-side="bottom"]::before {
  bottom: 100%;
  left: var(--hint-tail);
  border-bottom-color: #fff;
  transform: translateX(-50%);
}

.assistant-hint[data-side="top"]::before {
  top: 100%;
  left: var(--hint-tail);
  border-top-color: #fff;
  transform: translateX(-50%);
}

.assistant-hint p {
  margin: 0;
}

.assistant-hint-highlight {
  color: #5b21b6;
  font-size: 18px;
  font-weight: 700;
  margin-inline: 4px;
}

.assistant-hint-close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.assistant-hint-close:hover {
  background: #f2f2f2;
}

.assistant-panel {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(420px, calc(100vw - 24px));
  height: min(548px, calc(100dvh - 24px));
  min-width: min(300px, calc(100vw - 24px));
  min-height: min(340px, calc(100dvh - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 16px;
  overflow: hidden;
  border: 1px solid #ffffffba;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 100% 0%, #d9e5ff 0%, transparent 47%),
    radial-gradient(ellipse at 0% 0%, #e4dfff 0%, transparent 48%),
    #f6f7f9;
  box-shadow: 0 18px 64px #1c194233, 0 2px 10px #24213e12;
  color: #272932;
  font: 400 14px/1.7 Arial, "Microsoft YaHei", sans-serif;
}

.assistant-panel:popover-open {
  display: flex;
  flex-direction: column;
}

.assistant-panel::backdrop {
  background: transparent;
}

.assistant-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.assistant-move > img {
  width: 30px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px #6962b933);
}

.assistant-header h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: #25264d;
  font-size: 17px;
  line-height: 1.4;
  font-weight: 700;
}

.assistant-move {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.assistant-move:active {
  cursor: grabbing;
}

.assistant-resize {
  position: absolute;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  color: #9293b1;
  touch-action: none;
}

.assistant-resize[data-resize="left"] {
  left: 2px;
  cursor: nesw-resize;
}

.assistant-resize[data-resize="right"] {
  right: 2px;
  cursor: nwse-resize;
}

.assistant-panel .assistant-resize svg {
  width: 13px;
  height: 13px;
}

.assistant-resize:hover {
  color: #6457d5;
}

.assistant-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  border-radius: 8px;
  color: #15171d;
}

.assistant-close:hover,
.assistant-close:focus-visible {
  background: #ffffff8c;
}

.assistant-panel svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-welcome {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 26px;
}

.assistant-welcome,
.assistant-thread,
.assistant-composer textarea {
  scrollbar-width: none;
}

.assistant-welcome::-webkit-scrollbar,
.assistant-thread::-webkit-scrollbar,
.assistant-composer textarea::-webkit-scrollbar {
  display: none;
}

.assistant-avatar {
  width: 114px;
  height: 118px;
  margin: 0 auto 50px;
  object-fit: contain;
  filter: drop-shadow(0 5px 9px #6259d833);
}

.assistant-welcome h3 {
  margin: 0 0 22px;
  color: #292a2d;
  font-size: 20px;
  line-height: 1.5;
  font-weight: 700;
  text-align: center;
}

.assistant-intro {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eeebff, #eaecf4);
  font-size: 14px;
  line-height: 1.75;
}

.assistant-composer {
  flex: none;
  margin-top: 18px;
  padding: 10px 9px 7px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: linear-gradient(#fff, #fff) padding-box,
    linear-gradient(110deg, #d952ff, #6ca5ff) border-box;
}

.assistant-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 2px 4px;
}

.assistant-message {
  width: fit-content;
  max-width: 92%;
  margin-bottom: 14px;
  padding: 10px 13px;
  border-radius: 14px 14px 14px 4px;
  background: #eeebfa;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.assistant-message--user {
  margin-left: auto;
  border-radius: 14px 14px 4px 14px;
  background: #e0eaff;
}

.assistant-message-author {
  display: block;
  margin-bottom: 4px;
  color: #6a628a;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.assistant-message p {
  margin: 0;
}

.assistant-message-image {
  display: block;
  width: min(220px, 100%);
  max-height: 220px;
  margin-top: 8px;
  border-radius: 8px;
  object-fit: contain;
}

.assistant-message.is-incomplete {
  border: 1px dashed #ad8193;
}

.assistant-message small {
  display: block;
  margin-top: 6px;
  color: #96536a;
}

.assistant-status {
  flex: none;
  margin: 8px 2px 0;
  color: #79728d;
  font-size: 12px;
  line-height: 1.6;
}

.assistant-status.is-error {
  color: #a04360;
}

.assistant-status:not([hidden]) + .assistant-composer {
  margin-top: 8px;
}

.assistant-composer textarea {
  display: block;
  width: 100%;
  height: 58px;
  min-height: 58px;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #272932;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.assistant-composer textarea::placeholder {
  color: #b9bbc3;
}

.assistant-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 0 8px;
  padding: 6px;
  border-radius: 8px;
  background: #f0f1f8;
}

.assistant-attachment-preview {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 6px;
  object-fit: cover;
}

.assistant-attachment-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #6f7180;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-remove-image {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 6px;
  color: #65677a;
}

.assistant-remove-image:hover {
  background: #ffffff;
  color: #a04360;
}

.assistant-remove-image svg {
  width: 17px;
  height: 17px;
}

.assistant-composer:focus-within {
  box-shadow: 0 0 0 2px #b391ff24;
}

.assistant-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.assistant-input-hint {
  flex: 1;
  margin: 0;
  color: #9293a5;
  font-size: 10px;
  line-height: 1.5;
}

.assistant-actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  opacity: 1;
}

.assistant-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.assistant-upload {
  color: #82869e;
}

.assistant-actions .assistant-send {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 4px;
  width: auto;
  min-width: 76px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: linear-gradient(130deg, #8470ff, #3f7cff);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.assistant-send svg {
  width: 18px;
  height: 18px;
}

.assistant-send svg[hidden] {
  display: none;
}

.assistant-send:not(:disabled):hover {
  filter: brightness(1.08);
}

.assistant-actions .assistant-send:not(:disabled) {
  cursor: pointer;
}

.assistant-send:disabled {
  opacity: 0.55;
}

.assistant-widget button:focus-visible {
  outline: 2px solid #6457d5;
  outline-offset: 3px;
}

.assistant-widget .assistant-close:focus,
.assistant-widget .assistant-close:focus-visible {
  outline: none;
  box-shadow: none;
}

@media (min-width: 768px) and (max-width: 960px) {
  .assistant-launcher {
    top: calc(var(--margin) + 36px);
  }
}

@media (max-width: 480px) {
  .assistant-welcome h3 {
    font-size: 18px;
  }

  .assistant-composer textarea {
    font-size: 16px;
  }
}

@media (max-height: 620px) {
  .assistant-welcome {
    padding-top: 12px;
  }

  .assistant-avatar {
    width: 80px;
    height: 84px;
    margin-bottom: 18px;
  }

  .assistant-welcome h3 {
    margin-bottom: 14px;
  }
}
