/* 打开对话时锁住官网滚动，避免和外层页面抢滚动条 */
html.phaix-chat-lock,
html.phaix-chat-lock body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* PhaiX AI：对齐官网侧栏 .divOne 风格 */
.phaix-chat-root {
  --phaix-brand: #81b745;
  --phaix-panel-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
  font-family: inherit;
}

.phaix-chat-launcher {
  position: fixed;
  right: 10px;
  bottom: 120px;
  z-index: 10040;
  width: 69px;
  height: 69px;
  border: none;
  padding: 0;
  text-align: center;
  background-color: var(--phaix-brand);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(129, 183, 69, 0.4);
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.phaix-chat-launcher:hover {
  background-color: #6fa33a;
  color: #fff;
  box-shadow: 0 8px 24px rgba(129, 183, 69, 0.45);
  transform: scale(1.08) translateY(-2px);
}

.phaix-chat-launcher.is-open {
  background-color: #fff;
  color: #666;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  transform: rotate(90deg);
}

.phaix-chat-launcher.is-open:hover {
  background-color: #f5f5f5;
  color: #333;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transform: rotate(90deg) scale(1.04);
}

.phaix-chat-root.is-maximized .phaix-chat-launcher {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

html.phaix-chat-open #header .divOne.goTop {
  display: none !important;
}

.phaix-chat-launcher .iconfont {
  font-size: 40px;
  font-weight: bold;
  line-height: 1;
  color: inherit;
}

.phaix-chat-launcher .phaix-icon-close {
  display: none;
  font-size: 30px;
}

.phaix-chat-launcher.is-open .phaix-icon-chat {
  display: none;
}

.phaix-chat-launcher.is-open .phaix-icon-close {
  display: block;
}

#header .divOne.goTop {
  bottom: 40px;
  right: 10px;
  border-radius: 50%;
  background-color: #81b745;
  box-shadow: 0 8px 24px rgba(129, 183, 69, 0.4);
  transition: all 0.3s ease;
  z-index: 10039;
}

#header .divOne.goTop > i {
  color: #fff;
  line-height: 69px;
}

#header .divOne.goTop:hover {
  background-color: #6fa33a;
  box-shadow: 0 8px 24px rgba(129, 183, 69, 0.45);
  transform: scale(1.08) translateY(-2px);
}

.phaix-chat-panel {
  position: fixed;
  right: 40px;
  bottom: 200px;
  z-index: 10050;
  width: 800px;
  height: 720px;
  max-width: calc(100vw - 80px);
  max-height: calc(100vh - 160px);
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--phaix-panel-shadow);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  overscroll-behavior: contain;
  display: none;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  transform-origin: bottom right;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    width 0.25s ease,
    height 0.25s ease,
    right 0.25s ease,
    bottom 0.25s ease,
    border-radius 0.25s ease;
}

.phaix-chat-panel.is-visible {
  display: flex;
}

.phaix-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0);
}

.phaix-chat-panel.is-maximized {
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0;
  transform: none;
}

/* 仅保留操作栏，不重复 iframe 内标题 */
.phaix-chat-toolbar {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  user-select: none;
}

.phaix-chat-action {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.phaix-chat-action:hover {
  background: #f0f2f5;
  color: #333;
}

.phaix-chat-action.phaix-chat-close:hover {
  color: #e14;
  background: #fee;
}

.phaix-chat-action .iconfont {
  font-size: 16px;
  line-height: 1;
}

.phaix-chat-action svg {
  width: 16px;
  height: 16px;
}

.phaix-chat-body {
  flex: 1 1 auto;
  position: relative;
  background: #f5f7fa;
  min-height: 0;
}

.phaix-chat-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
  overflow: hidden;
}

.phaix-chat-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #666;
  font-size: 14px;
  background: #f5f7fa;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.phaix-chat-loading.is-hidden {
  opacity: 0;
}

.phaix-chat-loading-dots {
  display: flex;
  gap: 6px;
}

.phaix-chat-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--phaix-brand);
  animation: phaix-dot 1.2s infinite ease-in-out both;
}

.phaix-chat-loading-dots span:nth-child(1) {
  animation-delay: -0.24s;
}

.phaix-chat-loading-dots span:nth-child(2) {
  animation-delay: -0.12s;
}

@keyframes phaix-dot {
  0%,
  80%,
  100% {
    transform: scale(0.75);
    opacity: 0.45;
  }
  40% {
    transform: scale(1.15);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .phaix-chat-launcher {
    right: 10px;
    bottom: 88px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
  }

  .phaix-chat-launcher .iconfont {
    font-size: 32px;
  }

  .phaix-chat-launcher .phaix-icon-close {
    font-size: 24px;
  }

  .phaix-chat-panel {
    right: 20px;
    bottom: 160px;
    width: calc(100vw - 40px);
    height: calc(100vh - 260px);
    max-width: none;
    max-height: none;
    border-radius: 12px;
  }

  .phaix-chat-maximize {
    display: none;
  }

  #header .divOne.goTop {
    right: 10px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    display: block !important;
  }

  #header .divOne.goTop > i {
    line-height: 60px;
  }
}
