:root {
  --xz-brand:#2563eb;
  --xz-accent:#22d3ee;
  --xz-user:#1f2937;
  --xz-agent:linear-gradient(135deg,#2563eb,#3b82f6);
  --xz-shadow:0 12px 30px rgba(0,0,0,.35);
  --xz-muted:#94a3b8;
}

/* 启动器 */
#xz-launcher{position:fixed;right:18px;bottom:18px;z-index:9999;display:flex;align-items:center;gap:8px;cursor:pointer;}
#xz-launcher .xz-agent{width:64px;height:64px;border-radius:50%;overflow:hidden;box-shadow:var(--xz-shadow);}
#xz-launcher .xz-agent img{width:100%;height:100%;object-fit:cover;}
#xz-launcher .xz-bubble{background:#fff;color:#0b1220;border-radius:18px;padding:8px 12px;font-size:14px;font-weight:600;box-shadow:var(--xz-shadow);}
#xz-badge{position:fixed;right:95px;bottom:76px;background:#ff1744;color:#fff;width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:13px;border:2px solid #fff;box-shadow:0 0 8px rgba(255,23,68,.6);animation:xz-pulse 1.1s infinite;z-index:99999;}
@keyframes xz-pulse{0%{transform:scale(1);}50%{transform:scale(1.2);}100%{transform:scale(1);}}

/* 欢迎语 */
#xz-tip{position:fixed;right:90px;bottom:80px;background:rgba(255,255,255,.95);color:#111;padding:10px 14px;border-radius:14px;box-shadow:var(--xz-shadow);font-size:14px;max-width:220px;display:none;animation:xz-tipfade 0.4s ease;}
@keyframes xz-tipfade{from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:translateY(0);}}

/* 聊天框 */
#xz-chat{
  position:fixed;
  right:18px;
  bottom:18px;
  width:360px;
  max-width:calc(100vw - 24px);
  height:66vh;
  max-height:640px;
  min-height:520px;
  background:#0b1220;
  border-radius:18px;
  overflow:hidden;
  box-shadow:var(--xz-shadow);
  display:none;
  color:#e5e7eb;
  display:flex;
  flex-direction:column;
  transition:transform .25s ease; /* 让抬升平滑 */
  z-index:9999;
}
@media(max-width:520px){
  #xz-chat{
    width:100vw;
    right:0;
    bottom:0;
    height:100vh;  /* 锁定 */
    border-radius:0;
  }
}
.xz-show{animation:xz-pop .25s ease-out forwards;}
.xz-hide{animation:xz-fade .25s ease-in forwards;}
@keyframes xz-pop{0%{opacity:0;transform:scale(.9);}100%{opacity:1;transform:scale(1);}}
@keyframes xz-fade{0%{opacity:1;transform:scale(1);}100%{opacity:0;transform:scale(.9);}}

/* 顶部 */
.xz-head{display:flex;align-items:center;gap:10px;padding:12px 14px;background:rgba(30,41,59,.7);}
.xz-avatar{width:36px;height:36px;border-radius:50%;overflow:hidden;}
.xz-avatar img{width:100%;height:100%;object-fit:cover;}
.xz-title strong{display:block;font-size:15px;}
.xz-title span{font-size:12px;color:var(--xz-muted);}
.xz-head button{margin-left:auto;background:#0f172a;color:#cbd5e1;border:1px solid rgba(148,163,184,.16);border-radius:10px;width:32px;height:32px;cursor:pointer;}
.xz-head button:hover{background:#111827;}

/* 内容（修复滚动） */
.xz-body{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:14px 14px 120px; /* 底部留空间，避免按钮被遮挡 */
  background:#0b1220;
  scroll-behavior:smooth;
}
.xz-body::-webkit-scrollbar{width:6px;}
.xz-body::-webkit-scrollbar-thumb{background:#334155;border-radius:3px;}
.xz-body::-webkit-scrollbar-thumb:hover{background:#64748b;}
.xz-msg{display:flex;gap:10px;margin:8px 0;align-items:flex-end;}
.xz-msg .xz-avatar{width:30px;height:30px;border-radius:50%;overflow:hidden;}
.xz-msg .xz-avatar img{width:100%;height:100%;object-fit:cover;}
.xz-msg .xz-bubble{max-width:72%;padding:10px 12px;border-radius:14px;font-size:14px;line-height:1.55;color:#fff;}
.xz-msg.agent .xz-bubble{background:var(--xz-agent);}
.xz-msg.user{flex-direction:row-reverse;}
.xz-msg.user .xz-bubble{background:var(--xz-user);}
.xz-time{font-size:11px;color:var(--xz-muted);margin:0 6px;}
.xz-typing{display:flex;align-items:center;gap:3px;color:#aaa;font-size:13px;margin:6px 0;}
.xz-dot{width:6px;height:6px;background:#aaa;border-radius:50%;animation:xz-blink 1s infinite;}
.xz-dot:nth-child(2){animation-delay:.2s;}
.xz-dot:nth-child(3){animation-delay:.4s;}
@keyframes xz-blink{0%,100%{opacity:.3;}50%{opacity:1;}}

/* 选项 */
.xz-choices{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;}
.xz-choice{background:#1f2937;color:#fff;border:none;border-radius:12px;padding:8px 14px;cursor:pointer;font-size:13px;transition:.2s;}
.xz-choice:hover{background:#2563eb;}
.xz-choice:active{transform:scale(0.95);}

/* 底部输入区 (sticky 修复) */
.xz-foot{
  position:sticky;        /* 让它随内容滚动固定在底部 */
  bottom:0;
  left:0;
  width:100%;
  background:#0b1220;
  border-top:1px solid rgba(148,163,184,.12);
  padding:10px;
  display:none;
  z-index:2;
}
#xz-hint{font-size:12px;color:#94a3b8;margin-bottom:6px;}
#xz-contact{width:calc(100% - 110px);background:#0f172a;border:1px solid rgba(148,163,184,.18);border-radius:12px;color:#e5e7eb;padding:10px 12px;}
#xz-send{background:linear-gradient(90deg,var(--xz-brand),var(--xz-accent));border:none;color:#fff;padding:0 16px;border-radius:12px;font-weight:700;height:40px;cursor:pointer;white-space:nowrap;flex-shrink:0;}