/* 泉江助手 v2 —— 重新设计 */
#qj-assistant-root, #qj-assistant-root * { box-sizing: border-box; }
#qj-assistant-root {
  position: fixed; right: 26px; bottom: 26px; z-index: 2147483000;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ============ 悬浮按钮 ============ */
#qj-assistant-root .qj-btn {
  position: relative; width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 32% 26%, #6cc4ff 0%, #1487ea 46%, #0a5cc4 100%);
  box-shadow: 0 12px 28px rgba(10, 92, 196, .34), 0 3px 8px rgba(10, 92, 196, .2), inset 0 1px 0 rgba(255,255,255,.45);
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s ease;
  animation: qjFloat 3.6s ease-in-out infinite;
}
#qj-assistant-root .qj-btn:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 18px 36px rgba(10, 92, 196, .44), 0 6px 12px rgba(10, 92, 196, .24), inset 0 1px 0 rgba(255,255,255,.5);
  animation-play-state: paused;
}
#qj-assistant-root .qj-btn:active { transform: scale(.96); }
@keyframes qjFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
#qj-assistant-root .qj-btn img { width: 44px; height: 44px; display: block; filter: drop-shadow(0 2px 3px rgba(3, 46, 96, .28)); pointer-events: none; }
#qj-assistant-root .qj-btn .qj-ring {
  position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(20, 135, 234, .5);
  animation: qjRing 2.8s ease-out infinite; pointer-events: none;
}
@keyframes qjRing { 0% { transform: scale(.92); opacity: .75; } 70% { transform: scale(1.28); opacity: 0; } 100% { opacity: 0; } }
#qj-assistant-root .qj-btn .qj-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: linear-gradient(135deg, #ff7a59, #ff4d4f); color: #fff; font-size: 11.5px; font-weight: 700;
  display: none; align-items: center; justify-content: center; box-shadow: 0 3px 8px rgba(255, 77, 79, .4);
  border: 2px solid #fff;
}
#qj-assistant-root .qj-btn .qj-badge.show { display: flex; animation: qjPop .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes qjPop { from { transform: scale(0); } to { transform: scale(1); } }
/* 面板打开时隐藏悬浮按钮，避免遮挡 */
#qj-assistant-root.qj-open .qj-btn { opacity: 0; pointer-events: none; transform: scale(.5); transition: opacity .2s ease, transform .2s ease; }

/* ============ 悬停招呼气泡 ============ */
#qj-assistant-root .qj-tip {
  position: absolute; right: 82px; bottom: 4px; width: 296px;
  background: #fff; border-radius: 18px; padding: 16px 18px 16px 16px;
  box-shadow: 0 18px 44px rgba(15, 40, 80, .18), 0 4px 12px rgba(15, 40, 80, .08);
  border: 1px solid rgba(20, 135, 234, .1);
  display: flex; gap: 12px; align-items: flex-start;
  opacity: 0; transform: translateY(10px) scale(.96); transform-origin: right bottom;
  pointer-events: none; transition: opacity .26s ease, transform .26s cubic-bezier(.34,1.56,.64,1);
}
#qj-assistant-root .qj-tip::after {
  content: ""; position: absolute; right: -7px; bottom: 22px; width: 14px; height: 14px; background: #fff;
  transform: rotate(45deg); border-radius: 3px;
  box-shadow: 2px -2px 6px rgba(15, 40, 80, .05);
}
#qj-assistant-root .qj-tip.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; cursor: pointer; }
#qj-assistant-root .qj-tip .qj-tip-ava {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(160deg, #eaf6ff, #d7ecff); display: flex; align-items: center; justify-content: center;
}
#qj-assistant-root .qj-tip .qj-tip-ava img { width: 34px; height: 34px; display: block; }
#qj-assistant-root .qj-tip .qj-tip-main { flex: 1 1 auto; min-width: 0; }
#qj-assistant-root .qj-tip .qj-tip-name {
  font-size: 13px; font-weight: 700; color: #0a5cc4; margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
#qj-assistant-root .qj-tip .qj-tip-name::after {
  content: "AI"; font-size: 9.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg,#1487ea,#0a5cc4);
  border-radius: 5px; padding: 1px 5px; letter-spacing: .5px;
}
#qj-assistant-root .qj-tip .qj-tip-text { font-size: 13px; line-height: 1.62; color: #334155; word-break: break-word; }
#qj-assistant-root .qj-tip .qj-tip-cta {
  margin-top: 8px; font-size: 12px; color: #1487ea; font-weight: 600; display: inline-flex; align-items: center; gap: 4px;
}

/* ============ 对话框 ============ */
#qj-assistant-root .qj-panel {
  position: absolute; right: 0; bottom: 82px; width: 406px; height: 620px;
  max-height: calc(100vh - 132px);
  background: #fff; border-radius: 24px; overflow: hidden;
  box-shadow: 0 32px 80px rgba(8, 32, 70, .26), 0 8px 24px rgba(8, 32, 70, .12);
  border: 1px solid rgba(20, 135, 234, .1);
  display: none; flex-direction: column;
}
#qj-assistant-root .qj-panel.open { display: flex; animation: qjPanelIn .32s cubic-bezier(.2,.9,.3,1.05); }
@keyframes qjPanelIn {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 头部 */
#qj-assistant-root .qj-head {
  flex: 0 0 auto; padding: 16px 16px 14px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0a67cf 0%, #1487ea 52%, #3fa9f5 100%);
  color: #fff; display: flex; align-items: center; gap: 12px;
}
#qj-assistant-root .qj-head::after {
  content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  right: -70px; top: -110px; background: rgba(255, 255, 255, .12);
}
#qj-assistant-root .qj-head::before {
  content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%;
  right: 40px; bottom: -90px; background: rgba(255, 255, 255, .08);
}
#qj-assistant-root .qj-head .qj-ava {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 15px; background: rgba(255, 255, 255, .22);
  border: 1.5px solid rgba(255, 255, 255, .5); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); position: relative; z-index: 1;
}
#qj-assistant-root .qj-head .qj-ava img { width: 36px; height: 36px; display: block; }
#qj-assistant-root .qj-head h4 {
  margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .3px; line-height: 1.25;
  display: flex; align-items: center; gap: 8px; position: relative; z-index: 1;
}
#qj-assistant-root .qj-head h4 em {
  font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .6px;
  background: rgba(255, 255, 255, .26); border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 6px; padding: 1px 6px;
}
#qj-assistant-root .qj-head p {
  margin: 3px 0 0; font-size: 11.5px; opacity: .92; display: flex; align-items: center; gap: 6px; position: relative; z-index: 1;
}
#qj-assistant-root .qj-head .qj-live { width: 6px; height: 6px; border-radius: 50%; background: #6ee7a8; box-shadow: 0 0 0 3px rgba(110, 231, 168, .25); }
#qj-assistant-root .qj-head .qj-actions { margin-left: auto; display: flex; gap: 6px; position: relative; z-index: 2; }
#qj-assistant-root .qj-head .qj-iconbtn {
  width: 30px; height: 30px; border-radius: 9px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background .16s ease;
}
#qj-assistant-root .qj-head .qj-iconbtn:hover { background: rgba(255, 255, 255, .32); }

/* 消息区 */
#qj-assistant-root .qj-body {
  flex: 1 1 auto; overflow-y: auto; padding: 18px 16px 8px; background: #f6f9fe;
  scroll-behavior: smooth;
}
#qj-assistant-root .qj-body::-webkit-scrollbar { width: 6px; }
#qj-assistant-root .qj-body::-webkit-scrollbar-thumb { background: rgba(10, 92, 196, .18); border-radius: 3px; }

/* 欢迎卡片 */
#qj-assistant-root .qj-welcome {
  background: linear-gradient(180deg, #ffffff 0%, #f4faff 100%);
  border: 1px solid rgba(20, 135, 234, .12); border-radius: 18px; padding: 16px 16px 14px;
  box-shadow: 0 6px 18px rgba(16, 74, 148, .07); margin-bottom: 14px; position: relative; overflow: hidden;
}
#qj-assistant-root .qj-welcome .qj-mascot {
  position: absolute; right: 6px; top: 34px; width: 86px; opacity: .95; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(10, 92, 196, .18));
}
#qj-assistant-root .qj-welcome h5 {
  margin: 0 0 6px; font-size: 14.5px; font-weight: 700; color: #0a4f9e;
  display: flex; align-items: center; gap: 7px;
}
#qj-assistant-root .qj-welcome h5 img { width: 22px; height: 22px; }
#qj-assistant-root .qj-welcome p { margin: 0; font-size: 13px; line-height: 1.68; color: #475569; max-width: 74%; }
#qj-assistant-root .qj-welcome .qj-chipwrap { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; position: relative; z-index: 1; }
#qj-assistant-root .qj-chip {
  text-align: left; border: 1px solid rgba(20, 135, 234, .18); background: #fff; color: #1e3a8a;
  border-radius: 11px; padding: 9px 11px; font-size: 12.5px; line-height: 1.35; cursor: pointer;
  transition: all .16s ease; display: flex; align-items: center; gap: 7px; min-height: 42px;
}
#qj-assistant-root .qj-chip i {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 6px; background: linear-gradient(135deg, #e3f2ff, #cfe8ff);
  color: #0a6ed6; font-size: 10.5px; font-style: normal; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
#qj-assistant-root .qj-chip:hover {
  background: linear-gradient(135deg, #f0f8ff, #e6f3ff); border-color: rgba(20, 135, 234, .38);
  transform: translateY(-1px); box-shadow: 0 6px 14px rgba(20, 135, 234, .12);
}

/* 消息气泡 */
#qj-assistant-root .qj-msg { display: flex; gap: 8px; margin-bottom: 14px; align-items: flex-start; }
#qj-assistant-root .qj-msg .qj-mini {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(160deg, #eaf6ff, #d5ebff);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(16, 74, 148, .1);
}
#qj-assistant-root .qj-msg .qj-mini img { width: 23px; height: 23px; display: block; }
#qj-assistant-root .qj-msg .qj-bubble {
  max-width: 82%; padding: 11px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
}
#qj-assistant-root .qj-bot .qj-bubble {
  background: #fff; color: #1f2937; border-top-left-radius: 5px;
  box-shadow: 0 3px 12px rgba(16, 74, 148, .08); border: 1px solid rgba(20, 135, 234, .07);
}
#qj-assistant-root .qj-me { justify-content: flex-end; }
#qj-assistant-root .qj-me .qj-bubble {
  background: linear-gradient(135deg, #0f7adf, #3fa9f5); color: #fff; border-top-right-radius: 5px;
  box-shadow: 0 6px 16px rgba(15, 122, 223, .28);
}
#qj-assistant-root .qj-link {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 9px; font-size: 12.5px; font-weight: 600;
  color: #0a6ed6; text-decoration: none; border: 1px solid rgba(20, 135, 234, .28); border-radius: 9px;
  padding: 5px 11px; background: rgba(20, 135, 234, .06); transition: all .16s ease;
}
#qj-assistant-root .qj-link:hover { background: rgba(20, 135, 234, .14); border-color: rgba(20, 135, 234, .45); }
#qj-assistant-root .qj-fb { margin-top: 7px; display: flex; gap: 8px; opacity: .5; font-size: 12px; }
#qj-assistant-root .qj-fb button {
  border: none; background: none; cursor: pointer; font-size: 13px; padding: 0; line-height: 1;
  transition: transform .14s ease, opacity .14s ease;
}
#qj-assistant-root .qj-fb button:hover { transform: scale(1.2); opacity: 1; }
#qj-assistant-root .qj-fb.done { opacity: .3; pointer-events: none; }

/* 打字中 */
#qj-assistant-root .qj-typing { display: inline-flex; gap: 5px; padding: 3px 2px; align-items: center; }
#qj-assistant-root .qj-typing i { width: 6.5px; height: 6.5px; border-radius: 50%; background: #93b8e0; animation: qjBlink 1.2s infinite; }
#qj-assistant-root .qj-typing i:nth-child(2) { animation-delay: .18s; }
#qj-assistant-root .qj-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes qjBlink { 0%, 80%, 100% { opacity: .28; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* 输入区 */
#qj-assistant-root .qj-foot { flex: 0 0 auto; padding: 10px 14px 12px; background: #fff; border-top: 1px solid #eef3fa; }
#qj-assistant-root .qj-inputrow {
  display: flex; align-items: flex-end; gap: 8px; background: #f4f8fd; border: 1px solid #e2ecf8;
  border-radius: 16px; padding: 6px 6px 6px 14px; transition: border-color .18s ease, box-shadow .18s ease;
}
#qj-assistant-root .qj-inputrow.focus { border-color: #7cc0f8; box-shadow: 0 0 0 3px rgba(63, 169, 245, .14); background: #fff; }
#qj-assistant-root .qj-input {
  flex: 1 1 auto; resize: none; border: none; outline: none; background: transparent;
  font-size: 13.5px; line-height: 1.6; max-height: 88px; padding: 6px 0; font-family: inherit; color: #111827;
}
#qj-assistant-root .qj-input::placeholder { color: #9cb3cc; }
#qj-assistant-root .qj-send {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #1487ea, #0a5cc4); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(10, 92, 196, .28); transition: transform .16s ease, box-shadow .16s ease;
}
#qj-assistant-root .qj-send:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(10, 92, 196, .36); }
#qj-assistant-root .qj-send:active { transform: scale(.94); }
#qj-assistant-root .qj-send svg { width: 17px; height: 17px; fill: #fff; }
#qj-assistant-root .qj-send:disabled { opacity: .45; cursor: default; transform: none; }
#qj-assistant-root .qj-hint {
  margin: 8px 2px 0; font-size: 11px; color: #9db0c7; text-align: center; display: flex;
  align-items: center; justify-content: center; gap: 5px;
}
#qj-assistant-root .qj-hint b { font-weight: 600; color: #7b93ad; }

/* 移动端 */
@media (max-width: 640px) {
  #qj-assistant-root { right: 16px; bottom: 16px; }
  #qj-assistant-root .qj-btn { width: 58px; height: 58px; }
  #qj-assistant-root .qj-btn img { width: 40px; height: 40px; }
  #qj-assistant-root .qj-tip { display: none; }
  #qj-assistant-root .qj-panel {
    position: fixed; inset: 0; width: 100vw; height: 100vh; max-height: none; right: 0; bottom: 0; border-radius: 0;
  }
  #qj-assistant-root .qj-welcome .qj-chipwrap { grid-template-columns: 1fr; }
}
