:root {
  --bg-img: url('bg.jpg');
  --accent: #38bdf8;
  --accent2: #22d3ee;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-line: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --text-dim: #94a3b8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  overflow: hidden;
  background: #0b1220;
}
.bg {
  position: fixed; inset: 0;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  filter: blur(3px) brightness(0.55) saturate(1.05);
  transform: scale(1.06);
  z-index: -2;
}
.bg-overlay {
  position: fixed; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(56,189,248,0.10), transparent 60%),
    linear-gradient(180deg, rgba(8,15,30,0.55) 0%, rgba(8,15,30,0.82) 100%);
  z-index: -1;
}

/* Hero */
.hero {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
.hero-badge {
  font-size: 13px; letter-spacing: 2px; color: var(--accent2);
  border: 1px solid var(--panel-line); padding: 6px 14px; border-radius: 999px;
  background: rgba(15,23,42,0.4); backdrop-filter: blur(6px); margin-bottom: 22px;
}
.hero-title {
  font-size: clamp(34px, 6vw, 68px); font-weight: 800; line-height: 1.12;
  background: linear-gradient(180deg, #ffffff, #bae6fd);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 6px 30px rgba(56,189,248,0.25);
}
.hero-sub {
  margin-top: 18px; font-size: clamp(16px, 2.4vw, 22px); color: var(--text);
  font-weight: 600; letter-spacing: 4px;
}
.hero-hint {
  margin-top: 14px; font-size: 14px; color: var(--text-dim); max-width: 520px;
}

/* 悬浮按钮 */
.assistant-btn {
  position: fixed; right: 28px; bottom: 28px; z-index: 30;
  width: 60px; height: 60px; border-radius: 50%;
  border: none; cursor: pointer; color: #04121f;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 30px rgba(34,211,238,0.45), inset 0 0 0 1px rgba(255,255,255,0.25);
  display: grid; place-items: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.assistant-btn:hover { transform: translateY(-3px) scale(1.04); }
.assistant-btn::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(34,211,238,0.5); animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { opacity: 0; }
}

/* 聊天面板 */
.chat-panel {
  position: fixed; right: 28px; bottom: 28px; z-index: 40;
  width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 56px));
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 18px; backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(20px) scale(0.98); opacity: 0; pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
}
.chat-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }

.chat-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--panel-line);
  background: linear-gradient(180deg, rgba(56,189,248,0.12), transparent);
}
.chat-avatar, .avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  color: #04121f; background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.chat-head-text { flex: 1; min-width: 0; }
.chat-name { font-weight: 700; font-size: 15px; }
.chat-status { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.chat-close {
  background: none; border: none; color: var(--text-dim); font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0 4px; transition: color .2s;
}
.chat-close:hover { color: #fff; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: rgba(148,163,184,0.4) transparent;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.4); border-radius: 3px; }

.msg { display: flex; gap: 10px; max-width: 100%; align-items: flex-end; }
.msg .avatar { width: 30px; height: 30px; font-size: 12px; border-radius: 9px; }
.msg.user { flex-direction: row-reverse; }
.bubble {
  padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; max-width: 82%;
}
.msg.bot .bubble {
  background: rgba(30,41,59,0.85); border: 1px solid var(--panel-line); border-bottom-left-radius: 5px;
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #04121f;
  border-bottom-right-radius: 5px; font-weight: 500;
}
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* 常问问题快捷入口 */
.chat-faq {
  padding: 12px 14px 4px;
  border-top: 1px solid var(--panel-line);
  background: rgba(2,6,23,0.25);
}
.faq-title {
  font-size: 12px; color: var(--text-dim); margin-bottom: 9px;
  display: flex; align-items: center; gap: 6px;
}
.faq-title::before {
  content: ""; width: 4px; height: 12px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
}
.faq-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.faq-chip {
  font-size: 13px; line-height: 1.3; color: var(--text);
  background: rgba(56,189,248,0.10); border: 1px solid rgba(56,189,248,0.35);
  border-radius: 999px; padding: 7px 12px; cursor: pointer;
  transition: background .2s, border-color .2s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.faq-chip:hover { background: rgba(56,189,248,0.20); border-color: var(--accent); }
.faq-chip:active { transform: scale(0.96); }
.faq-chip:disabled { opacity: .5; cursor: not-allowed; }

.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--panel-line); }
.chat-input input {
  flex: 1; background: rgba(2,6,23,0.6); border: 1px solid var(--panel-line);
  color: var(--text); border-radius: 12px; padding: 11px 14px; font-size: 14.5px; outline: none;
  transition: border-color .2s;
}
.chat-input input:focus { border-color: var(--accent); }
.chat-input button {
  width: 46px; flex: none; border: none; border-radius: 12px; cursor: pointer; color: #04121f;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; transition: opacity .2s, transform .15s;
}
.chat-input button:disabled { opacity: .5; cursor: not-allowed; }
.chat-input button:not(:disabled):hover { transform: scale(1.05); }

@media (max-width: 480px) {
  .assistant-btn {
    right: 16px; bottom: 16px;
    width: 54px; height: 54px;
  }
  /* 手机端聊天面板铺满全屏（含安全区） */
  .chat-panel {
    right: 0; left: 0; top: 0; bottom: 0;
    width: auto; height: auto;
    border-radius: 0;
    border: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .chat-header { padding-top: max(14px, env(safe-area-inset-top)); }
  .hero { padding: 24px 18px; }
  .hero-title { font-size: clamp(30px, 9vw, 46px); }
  .hero-sub { letter-spacing: 2px; }
}

/* 平板/小屏：面板稍大，避免顶满 */
@media (min-width: 481px) and (max-width: 600px) {
  .chat-panel { width: min(440px, calc(100vw - 24px)); }
}
