/* =========================================================
   首页 AI 助手悬浮组件（多彩渐变球 + 聊天气泡）
   命名空间 acy-*，与主站样式隔离
   ========================================================= */
:root {
  --acy-1: #4F7CFF;
  --acy-2: #7A5CFF;
  --acy-3: #FF6FA5;
  --acy-4: #FFB44D;
  --acy-5: #2FC79E;
}

/* ---------- 悬浮球 ---------- */
.acy-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 2147483000;
  width: 62px; height: 62px; padding: 0; border: 0; cursor: pointer;
  background: none; -webkit-tap-highlight-color: transparent;
}
.acy-fab__disc {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--acy-1), var(--acy-2), var(--acy-3), var(--acy-4), var(--acy-5), var(--acy-1));
  box-shadow: 0 10px 26px -6px rgba(79, 124, 255, .55), 0 2px 8px rgba(11, 13, 16, .12);
  animation: acySpin 7s linear infinite, acyBreath 3.4s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center;
}
@keyframes acySpin { to { transform: rotate(360deg); } }
@keyframes acyBreath {
  0%, 100% { box-shadow: 0 10px 26px -6px rgba(79, 124, 255, .5), 0 2px 8px rgba(11, 13, 16, .12); }
  50%      { box-shadow: 0 14px 34px -6px rgba(255, 111, 165, .55), 0 3px 10px rgba(11, 13, 16, .14); }
}
/* 内圈留白，让渐变呈环带 */
.acy-fab__core {
  position: absolute; inset: 5px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}
.acy-fab__core svg { width: 25px; height: 25px; color: var(--acy-2); }
.acy-fab:hover .acy-fab__core { transform: scale(1.09); }
.acy-fab:active .acy-fab__core { transform: scale(.96); }

/* 环绕光点 */
.acy-fab__orbit {
  position: absolute; inset: -4px; border-radius: 50%;
  animation: acySpin 4.2s linear infinite reverse;
  pointer-events: none;
}
.acy-fab__orbit i {
  position: absolute; top: 2px; left: 50%; width: 7px; height: 7px; margin-left: -3.5px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, .95);
}
/* 扩散光环 */
.acy-fab__pulse {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(122, 92, 255, .5);
  animation: acyPulse 2.6s cubic-bezier(.22, .61, .36, 1) infinite;
  pointer-events: none;
}
@keyframes acyPulse {
  0%   { transform: scale(1); opacity: .65; }
  70%  { transform: scale(1.75); opacity: 0; }
  100% { transform: scale(1.75); opacity: 0; }
}

/* 招呼泡泡 */
.acy-fab__hi {
  position: absolute; right: 74px; bottom: 14px; white-space: nowrap;
  background: #fff; color: #0B0D10; font-size: 13px; font-weight: 500;
  padding: 9px 14px; border-radius: 12px 12px 4px 12px;
  box-shadow: 0 6px 20px -4px rgba(11, 13, 16, .22);
  border: 1px solid rgba(0, 0, 0, .05);
  animation: acyHiIn .5s .8s cubic-bezier(.22, .61, .36, 1) both;
}
.acy-fab__hi::after {
  content: ""; position: absolute; right: -5px; bottom: 9px; width: 10px; height: 10px;
  background: #fff; transform: rotate(45deg);
  border-right: 1px solid rgba(0, 0, 0, .05); border-top: 1px solid rgba(0, 0, 0, .05);
}
@keyframes acyHiIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.acy-fab__hi.is-gone { opacity: 0; transform: translateX(8px); transition: all .3s; pointer-events: none; }

.acy-fab.is-hidden { opacity: 0; transform: scale(.6) translateY(10px); pointer-events: none; transition: all .28s cubic-bezier(.22, .61, .36, 1); }

/* 角标 */
.acy-fab__dot {
  position: absolute; top: 0; right: 0; width: 12px; height: 12px; border-radius: 50%;
  background: #FF3B6B; border: 2px solid #fff;
  animation: acyDot 1.6s ease-in-out infinite;
}
@keyframes acyDot { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.22); } }

/* ---------- 对话面板 ---------- */
.acy-panel {
  position: fixed; right: 26px; bottom: 26px; z-index: 2147483001;
  width: 384px; max-width: calc(100vw - 28px);
  height: 566px; max-height: calc(100vh - 40px);
  background: #fff; border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 26px 70px -14px rgba(11, 13, 16, .34), 0 0 0 1px rgba(11, 13, 16, .06);
  transform-origin: bottom right; transform: scale(.86) translateY(12px); opacity: 0;
  pointer-events: none;
  transition: transform .32s cubic-bezier(.22, .61, .36, 1), opacity .28s;
}
.acy-panel.is-open { transform: none; opacity: 1; pointer-events: auto; }

/* 头部 */
.acy-head {
  position: relative; padding: 15px 16px; color: #fff; flex-shrink: 0;
  background: linear-gradient(115deg, #4F7CFF 0%, #7A5CFF 48%, #FF6FA5 100%);
  background-size: 220% 220%;
  animation: acyShift 9s ease infinite;
  display: flex; align-items: center; gap: 11px;
}
@keyframes acyShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.acy-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
}
.acy-ava {
  position: relative; width: 38px; height: 38px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; flex: 0 0 38px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.acy-ava svg { width: 21px; height: 21px; color: var(--acy-2); }
.acy-ava::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .55); animation: acySpin 5s linear infinite;
  border-right-color: transparent; border-bottom-color: transparent;
}
.acy-head__txt { min-width: 0; flex: 1; }
.acy-head__t { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.acy-head__s {
  font-size: 11.5px; opacity: .85; margin-top: 2px;
  display: flex; align-items: center; gap: 5px; line-height: 1.3;
}
.acy-head__s i {
  width: 6px; height: 6px; border-radius: 50%; background: #4ADE80; flex: 0 0 6px;
  animation: acyBlink 1.8s ease-in-out infinite;
}
@keyframes acyBlink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.acy-x {
  background: rgba(255, 255, 255, .16); border: 0; color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  flex: 0 0 28px; transition: background .18s;
}
.acy-x:hover { background: rgba(255, 255, 255, .3); }
.acy-x svg { width: 15px; height: 15px; }

/* 消息区 */
.acy-body {
  flex: 1; overflow-y: auto; padding: 16px 16px 6px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: #D8DCE3 transparent;
  background: #FBFCFD;
}
.acy-body::-webkit-scrollbar { width: 6px; }
.acy-body::-webkit-scrollbar-thumb { background: #DFE3E9; border-radius: 99px; }

.acy-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.acy-msg.is-user { flex-direction: row-reverse; }
.acy-msg__av {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  background: conic-gradient(from 40deg, var(--acy-1), var(--acy-2), var(--acy-3), var(--acy-5), var(--acy-1));
  display: flex; align-items: center; justify-content: center;
  animation: acySpin 8s linear infinite;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}
.acy-msg__av svg { width: 13px; height: 13px; color: #fff; }
.acy-bub {
  padding: 9px 13px; font-size: 14px; line-height: 1.72;
  border-radius: 14px 14px 14px 4px;
  background: #fff; color: #2B303A;
  border: 1px solid #ECEFF3;
  box-shadow: 0 1px 2px rgba(11, 13, 16, .04);
  word-break: break-word; white-space: pre-wrap; max-width: 84%;
}
.acy-msg.is-user .acy-bub {
  background: linear-gradient(115deg, var(--acy-1), var(--acy-2));
  color: #fff; border-color: transparent;
  border-radius: 14px 14px 4px 14px;
}
.acy-bub.is-err { background: #FFF1F3; color: #C02A48; border-color: #FFD9E0; }
.acy-bub b { font-weight: 600; }
.acy-bub a { color: var(--acy-1); text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.acy-bub ul { margin: 6px 0 2px; padding-left: 2px; list-style: none; }
.acy-bub li { position: relative; padding-left: 14px; margin: 3px 0; }
.acy-bub li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--acy-3); }

/* 快捷操作按钮（消息内） */
.acy-acts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.acy-act {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: linear-gradient(115deg, var(--acy-1), var(--acy-2));
  color: #fff; border: 0; border-radius: 9px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}
.acy-act:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -4px rgba(122, 92, 255, .55); }
.acy-act.ghost {
  background: #fff; color: var(--acy-2); border: 1px solid #E3E7F5;
}
.acy-act.ghost:hover { box-shadow: 0 5px 14px -4px rgba(11, 13, 16, .16); }

/* 输入中 */
.acy-typing { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }
.acy-typing i {
  width: 6px; height: 6px; border-radius: 50%; animation: acyBounce 1.2s ease-in-out infinite;
}
.acy-typing i:nth-child(1) { background: var(--acy-1); animation-delay: 0s; }
.acy-typing i:nth-child(2) { background: var(--acy-3); animation-delay: .16s; }
.acy-typing i:nth-child(3) { background: var(--acy-4); animation-delay: .32s; }
@keyframes acyBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* 快捷问题 */
.acy-quick {
  padding: 8px 14px 0; display: flex; flex-wrap: wrap; gap: 7px; flex-shrink: 0; background: #FBFCFD;
}
.acy-q {
  background: #fff; border: 1px solid #E6EBF5; color: #454B57;
  border-radius: 99px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
  transition: all .18s; white-space: nowrap;
}
.acy-q:hover { border-color: var(--acy-2); color: var(--acy-2); background: #F6F4FF; transform: translateY(-1px); }

/* 输入栏 */
.acy-foot { flex-shrink: 0; padding: 10px 12px 12px; background: #fff; border-top: 1px solid #EFF1F4; }
.acy-input { display: flex; gap: 8px; align-items: flex-end; }
.acy-input textarea {
  flex: 1; min-width: 0; resize: none; border: 1px solid #E4E8F0; border-radius: 12px;
  padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.55; color: #0B0D10;
  max-height: 96px; outline: none; transition: border-color .18s, box-shadow .18s;
  background: #FCFCFD;
}
.acy-input textarea:focus { border-color: var(--acy-2); box-shadow: 0 0 0 3px rgba(122, 92, 255, .12); }
.acy-send {
  flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(115deg, var(--acy-1), var(--acy-2)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s, opacity .18s, box-shadow .18s;
}
.acy-send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px -5px rgba(122, 92, 255, .6); }
.acy-send:disabled { opacity: .45; cursor: not-allowed; }
.acy-send svg { width: 17px; height: 17px; }
.acy-dis {
  text-align: center; font-size: 10.5px; color: #A6ADB8; margin-top: 7px; line-height: 1.4;
}

@media (max-width: 480px) {
  .acy-fab { right: 16px; bottom: 16px; }
  .acy-fab__hi { right: 66px; }
  .acy-panel { right: 12px; left: 12px; bottom: 12px; width: auto; height: calc(100vh - 96px); }
}
@media (prefers-reduced-motion: reduce) {
  .acy-fab__disc, .acy-fab__orbit, .acy-fab__pulse, .acy-msg__av, .acy-ava::before, .acy-head, .acy-fab__dot, .acy-head__s i { animation: none !important; }
  .acy-typing i { animation: none !important; opacity: .6; }
}
