.port-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  color: #1f2d3d;
}

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

.port-chat__toggle {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: #1f70ff;
  color: #fff;
  box-shadow: 0 12px 28px rgba(31, 112, 255, 0.3);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 0 7px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.port-chat__toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(31, 112, 255, 0.38);
}

.port-chat__toggle-icon {
  width: 23px;
  height: 17px;
  border: 2px solid #fff;
  border-radius: 6px;
  position: relative;
  flex: 0 0 auto;
}

.port-chat__toggle-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: -5px;
  width: 7px;
  height: 7px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: skewY(-35deg);
  background: transparent;
}

.port-chat__toggle-text {
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  display: block;
}

.port-chat__panel {
  width: 410px;
  height: 640px;
  position: absolute;
  right: 0;
  bottom: 76px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(22, 34, 51, 0.18);
  border: 1px solid #e5ebf3;
}

.port-chat.is-open .port-chat__panel {
  display: flex;
  animation: portChatPanelIn 0.18s ease-out both;
}

.port-chat__header {
  padding: 14px 16px;
  background: #fff;
  color: #17233d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e8eef5;
}

.port-chat__title {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
}

.port-chat__close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #f2f5f9;
  color: #66778d;
  font-size: 22px;
  line-height: 28px;
  cursor: pointer;
}

.port-chat__close:hover {
  background: #e8eef5;
  color: #26364a;
}

.port-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: #f7f9fc;
  scrollbar-width: thin;
  scrollbar-color: #c4cfdd transparent;
}

.port-chat__body::-webkit-scrollbar {
  width: 6px;
}

.port-chat__body::-webkit-scrollbar-track {
  background: transparent;
}

.port-chat__body::-webkit-scrollbar-thumb {
  background: #c4cfdd;
  border-radius: 999px;
}

.port-chat__message {
  display: flex;
  margin-bottom: 14px;
}

.port-chat__message.is-latest .port-chat__bubble {
  animation: portChatBubbleIn 0.22s ease-out both;
}

.port-chat__message.is-user {
  justify-content: flex-end;
}

.port-chat__bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 3px 10px rgba(22, 34, 51, 0.04);
}

.port-chat__message.is-bot .port-chat__bubble {
  background: #fff;
  color: #24364d;
  border: 1px solid #e5edf6;
}

.port-chat__message.is-user .port-chat__bubble {
  background: #1f70ff;
  color: #fff;
}

.port-chat__quick {
  padding: 9px 12px 5px;
  background: #fff;
  border-top: 1px solid #e8eef5;
}

.port-chat__quick-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 5px;
  scrollbar-width: thin;
  scrollbar-color: #c4cfdd transparent;
}

.port-chat__quick-list::-webkit-scrollbar {
  height: 4px;
}

.port-chat__quick-list::-webkit-scrollbar-track {
  background: transparent;
}

.port-chat__quick-list::-webkit-scrollbar-thumb {
  background: #c4cfdd;
  border-radius: 999px;
}

.port-chat__chip {
  flex: 0 0 auto;
  width: auto;
  max-width: 220px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #cfe0f5;
  border-radius: 15px;
  background: #f7fbff;
  color: #23508c;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.port-chat__chip:hover {
  border-color: #1f70ff;
  color: #1f70ff;
}

.port-chat__footer {
  padding: 8px 12px 12px;
  background: #fff;
  border-top: 1px solid #e8eef5;
}

.port-chat__input-row {
  display: flex;
  gap: 8px;
}

.port-chat__input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #ccd8e6;
  border-radius: 6px;
  color: #1f2d3d;
  font-size: 14px;
  outline: none;
}

.port-chat__input:focus {
  border-color: #1f70ff;
  box-shadow: 0 0 0 3px rgba(31, 112, 255, 0.12);
}

.port-chat__send {
  width: 64px;
  border: 0;
  border-radius: 6px;
  background: #1f70ff;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.port-chat__send:hover {
  background: #155dd8;
}

@keyframes portChatPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes portChatBubbleIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .port-chat.is-open .port-chat__panel,
  .port-chat__message.is-latest .port-chat__bubble {
    animation: none;
  }

  .port-chat__toggle,
  .port-chat__chip {
    transition: none;
  }
}

@media screen and (max-width: 767px) {
  .port-chat {
    right: 14px;
    bottom: 14px;
  }

  .port-chat__toggle {
    width: 62px;
    height: 62px;
  }

  .port-chat__panel {
    width: calc(100vw - 28px);
    height: calc(100vh - 92px);
    max-height: 640px;
    bottom: 68px;
  }

  .port-chat__bubble {
    max-width: 88%;
  }

}
