/* --- 在线客服 悬浮入口（首页 / 剧集页 / 代理页共用） ------------------------
   用聊天类常见的绿色与站内金色按钮区分；头像 + 在线绿点 + 两行文案说明用途 */
:root {
  --kefu-1: #2fd67f;
  --kefu-2: #0fa45a;
}

.kefu-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 14px));
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 6px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--kefu-1), var(--kefu-2));
  box-shadow: 0 10px 30px rgba(15, 164, 90, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  color: #fff;
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.15;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kefu-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(15, 164, 90, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.25) inset; }
.kefu-fab:active { transform: scale(0.97); }

/* 脉冲光圈，吸引注意 */
.kefu-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: kefu-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes kefu-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(47, 214, 127, 0.65); }
  70%  { box-shadow: 0 0 0 16px rgba(47, 214, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 214, 127, 0); }
}

/* 客服头像 */
.kefu-avatar {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  color: var(--kefu-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kefu-avatar svg { width: 26px; height: 26px; }
.kefu-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2.5px #fff;
}

.kefu-text { display: flex; flex-direction: column; gap: 3px; }
.kefu-text b { font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }
.kefu-text small { font-size: 13px; opacity: 0.92; }

/* 提示气泡（js/site.js 每个会话弹一次，可关闭） */
.kefu-bubble {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(20px, calc(env(safe-area-inset-bottom) + 14px)) + 74px);
  z-index: 1000;
  max-width: 240px;
  padding: 12px 34px 12px 14px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: #1b1b1f;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  animation: kefu-bubble-in 0.3s ease;
}
.kefu-bubble b { color: var(--kefu-2); }
.kefu-bubble button {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  background: none;
  color: #999;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
@keyframes kefu-bubble-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }

/* 顶栏客服图标（手机端） */
.icon-btn.kefu-head { background: linear-gradient(135deg, var(--kefu-1), var(--kefu-2)); color: #fff; }

@media (max-width: 480px) {
  .kefu-fab { padding: 5px 16px 5px 5px; gap: 8px; }
  .kefu-avatar { width: 44px; height: 44px; }
  .kefu-avatar svg { width: 24px; height: 24px; }
  .kefu-text b { font-size: 15px; }
  .kefu-text small { font-size: 12px; }
  .kefu-bubble { bottom: calc(max(20px, calc(env(safe-area-inset-bottom) + 14px)) + 66px); }
}

@media (prefers-reduced-motion: reduce) {
  .kefu-fab::before, .kefu-bubble { animation: none; }
  .kefu-fab { transition: none; }
}
