/* ===== 老余财税 AI 客服气泡 ===== */
#ly-chat-root * { box-sizing: border-box; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }

.ly-chat-bubble {
  position: fixed; right: 26px; bottom: 26px; z-index: 99998;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 22px; border: none; border-radius: 30px;
  background: linear-gradient(135deg, #e8541e, #ff7a3c);
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 28px rgba(232, 84, 30, .5);
  transition: transform .2s ease, box-shadow .2s ease;
}
/* 脉冲光环：持续吸引注意力 */
.ly-chat-bubble::after {
  content: ''; position: absolute; inset: 0; border-radius: 30px;
  border: 2px solid #e8541e; animation: ly-pulse 2s ease-out infinite; pointer-events: none;
}
@keyframes ly-pulse {
  0%   { transform: scale(1);    opacity: .7; }
  100% { transform: scale(1.4);  opacity: 0;  }
}
.ly-chat-bubble:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(232, 84, 30, .6); }
.ly-chat-bubble .ly-emoji { font-size: 21px; }
.ly-chat-bubble .ly-sub {
  font-size: 11px; font-weight: 400; opacity: .92;
  padding-left: 6px; margin-left: 4px; border-left: 1px solid rgba(255,255,255,.5);
}
/* 首访引导浮层 */
.ly-chat-tip {
  position: fixed; right: 26px; bottom: 86px; z-index: 99997;
  max-width: 220px; padding: 11px 15px; border-radius: 12px;
  background: #fff; color: #333; font-size: 13px; line-height: 1.5;
  box-shadow: 0 10px 28px rgba(0,0,0,.2); border: 1px solid #ffd2b8;
  cursor: pointer; animation: ly-tip-in .35s ease both;
}
.ly-chat-tip b { color: #e8541e; font-weight: 700; }
.ly-chat-tip::after {
  content: ''; position: absolute; right: 34px; bottom: -8px;
  border: 8px solid transparent; border-top-color: #fff; border-bottom: 0;
}
@keyframes ly-tip-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
/* 抖动提示（首访时触发一次） */
.ly-chat-bubble.ly-shake { animation: ly-shake .6s ease; }
@keyframes ly-shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.ly-chat-panel {
  position: fixed; right: 22px; bottom: 84px; z-index: 99999;
  width: 364px; max-width: calc(100vw - 28px);
  height: 540px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
  border: 1px solid #f0e2d8;
}

.ly-chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, #e8541e, #ff7a3c);
}
.ly-chat-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.ly-chat-title { flex: 1; font-size: 15px; font-weight: 600; }
.ly-chat-close {
  background: transparent; border: none; color: #fff; font-size: 18px; cursor: pointer; line-height: 1;
  opacity: .85;
}
.ly-chat-close:hover { opacity: 1; }

.ly-chat-body {
  flex: 1; overflow-y: auto; padding: 14px 14px 6px;
  background: #fbf7f3; display: flex; flex-direction: column; gap: 10px;
}
.ly-msg { display: flex; gap: 8px; max-width: 100%; }
.ly-msg.user { flex-direction: row-reverse; }
.ly-msg .ly-avatar {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
}
.ly-msg.bot .ly-avatar { background: #e8541e; }
.ly-msg.user .ly-avatar { background: #4a7cff; }
.ly-bubble {
  max-width: 78%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
}
.ly-msg.bot .ly-bubble { background: #fff; color: #333; border: 1px solid #f0e2d8; border-top-left-radius: 3px; }
.ly-msg.user .ly-bubble { background: #4a7cff; color: #fff; border-top-right-radius: 3px; }
.ly-lead-note {
  align-self: center; background: #fff5ee; color: #c4470f; font-size: 12px;
  padding: 5px 10px; border-radius: 20px; border: 1px dashed #ffb98a;
}

.ly-chat-quick {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 4px;
  background: #fbf7f3; border-top: 1px solid #f0e2d8;
}
.ly-chat-quick button {
  font-size: 12px; padding: 5px 10px; border-radius: 16px; cursor: pointer;
  background: #fff; color: #e8541e; border: 1px solid #ffd2b8;
}
.ly-chat-quick button:hover { background: #fff0e6; }
.ly-chat-quick button.ly-call { background: #e8541e; color: #fff; border-color: #e8541e; }

.ly-chat-input {
  display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #f0e2d8;
}
.ly-chat-input input {
  flex: 1; border: 1px solid #e3d8cf; border-radius: 20px; padding: 9px 14px; font-size: 14px; outline: none;
}
.ly-chat-input input:focus { border-color: #e8541e; }
.ly-chat-input button {
  flex: 0 0 56px; border: none; border-radius: 20px; background: #e8541e; color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.ly-chat-input button:disabled { background: #c9bdb3; cursor: not-allowed; }

.ly-typing { display: flex; gap: 4px; padding: 10px 14px; }
.ly-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #d9c3b3; animation: ly-blink 1.2s infinite both;
}
.ly-typing span:nth-child(2) { animation-delay: .2s; }
.ly-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ly-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

@media (max-width: 480px) {
  /* 移动端抬高，避开浏览器底部工具栏遮挡，更方便点击 */
  .ly-chat-panel { right: 12px; bottom: 90px; width: calc(100vw - 24px); height: 70vh; }
  .ly-chat-bubble { right: 16px; bottom: 82px; }
  .ly-chat-bubble::after { inset: 0; }
  .ly-chat-tip { right: 16px; bottom: 140px; }
}
