/* ============ 线上获客诊断 —— 苹果官网极简风 ============ */
:root {
  --ink: #1d1d1f;
  --soft: #86868b;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --bg: #ffffff;
  --bubble-bot: #f2f2f7;
  --bubble-user: var(--blue);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ---------- 落地页 ---------- */
#landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 22px 28px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--ink);
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  padding-bottom: 8vh;
}

.hero h1 {
  font-size: clamp(46px, 10vw, 88px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.hero .sub {
  margin-top: 18px;
  font-size: clamp(18px, 3.4vw, 26px);
  font-weight: 400;
  color: var(--soft);
}

.hero .quota {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--soft);
  background: rgba(0,0,0,.04);
  border-radius: 980px;
  padding: 7px 16px;
}
.hero .quota.zero {
  color: #c0392b;
  background: rgba(192,57,43,.08);
}

.btn {
  margin-top: 44px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 980px;
  padding: 15px 44px;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn:hover { background: var(--blue-hover); }
.btn:active { transform: scale(.97); }

.foot {
  padding: 26px 24px calc(26px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13px;
  color: var(--soft);
}

/* ---------- 聊天界面 ---------- */
.chat {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.chat-title {
  font-size: 17px;
  font-weight: 600;
}

.quota-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--soft);
  background: rgba(0,0,0,.05);
  border-radius: 980px;
  padding: 4px 12px;
  margin-left: auto;
  margin-right: 10px;
  white-space: nowrap;
}
.quota-badge.zero {
  color: #c0392b;
  background: rgba(192,57,43,.08);
}

.back {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--blue);
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: background .15s;
}
.back:hover { background: rgba(0,113,227,.08); }
.back.idle { font-size: 18px; color: var(--soft); }

.messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.msg {
  display: flex;
  max-width: 88%;
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; }

.bubble {
  padding: 12px 18px;
  border-radius: 22px;
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg.bot .bubble {
  background: var(--bubble-bot);
  border-bottom-left-radius: 6px;
}
.msg.user .bubble {
  background: var(--bubble-user);
  color: #fff;
  border-bottom-right-radius: 6px;
}

/* 气泡内排版 */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 700; }
.bubble ul, .bubble ol { margin: 6px 0 8px; padding-left: 20px; }
.bubble li { margin: 3px 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { font-size: 1.08em; margin: 10px 0 6px; }
.bubble hr { border: none; border-top: 1px dashed rgba(0,0,0,.15); margin: 10px 0; }
.bubble a { color: var(--blue); text-decoration: underline; }
.bubble blockquote {
  border-left: 3px solid var(--soft);
  margin: 8px 0;
  padding: 2px 12px;
  color: var(--soft);
}
.bubble code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 5px; font-size: .9em; }

.input-area {
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.typing {
  display: flex;
  gap: 5px;
  padding: 10px 4px 8px;
}
.typing .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--soft);
  animation: pulse 1.2s infinite;
}
.typing .dot:nth-child(2) { animation-delay: .15s; }
.typing .dot:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%,60%,100% { opacity: .35; } 30% { opacity: 1; } }

.row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(0,0,0,.1);
  background: var(--bubble-bot);
  border-radius: 22px;
  padding: 12px 18px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 120px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
#input:focus { border-color: rgba(0,113,227,.5); }

.send {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
}
.send:hover { background: var(--blue-hover); }
.send:active { transform: scale(.95); }
.send:disabled { opacity: .45; cursor: default; }