/* CHUNSE native chat widget — Obsidian 智能客服秒开 */
/* 不再给 body 加底边距：会在深色页脚下方露出一条「黑边」 */

.cw-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 9200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}
.cw-fab > * { pointer-events: auto; }

/* 旧版 React 黑色圆钮（aria-label=智能顾问）以及历史客服壳：一律去掉 */
button[aria-label="智能顾问"],
.chunse-chat__fab,
.chunse-chat__backdrop,
.chunse-chat__panel,
.chunse-chat__bubble {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 顾问胶囊：金标 + 姓名 + 身份，单层、无投影叠影 */
.cw-fab.is-hidden {
  display: none !important;
}
.cw-fab-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  filter: none;
  outline: none;
  cursor: pointer;
  transition: transform 0.18s ease;
}
.cw-fab-btn::-moz-focus-inner { border: 0; padding: 0; }
.cw-fab-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 132px;
  height: 52px;
  padding: 0 14px 0 16px;
  border-radius: 999px;
  background: #f4efe6;
  flex-shrink: 0;
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.14);
  animation: cw-fab-breathe 2.6s ease-in-out infinite;
}
.cw-fab-logo {
  display: block;
  width: 92px;
  height: 24px;
  flex-shrink: 0;
}
.cw-fab-live {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #8ea36a;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(142, 163, 106, 0.45);
}
@keyframes cw-fab-breathe {
  0%, 100% {
    opacity: 0.62;
    box-shadow: 0 8px 18px rgba(28, 25, 23, 0.08), 0 0 0 0 rgba(142, 163, 106, 0);
  }
  50% {
    opacity: 1;
    box-shadow: 0 12px 28px rgba(28, 25, 23, 0.16), 0 0 22px 3px rgba(142, 163, 106, 0.55);
  }
}
.cw-fab-btn.is-open .cw-fab-mark {
  animation: none;
  opacity: 1;
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.14);
}
@media (prefers-reduced-motion: reduce) {
  .cw-fab-mark {
    animation: none;
    opacity: 1;
  }
}
.cw-fab-btn:hover {
  transform: translateY(-1px);
}
.cw-fab-btn:active { transform: translateY(0); }
.cw-fab-btn:focus-visible { border-color: #e6d3b4; }
.cw-fab-btn.is-open {
  border-color: rgba(212, 184, 150, 0.9);
}

.cw-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  z-index: 9300;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  background: #faf7f2;
  color: #1c1917;
  border: 1px solid rgba(28,25,23,.08);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  overflow: hidden;
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px);
  transition:
    opacity 0.42s ease,
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.42s ease;
}
.cw-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}
/* 不盖全屏遮罩：打开对话不挡滑动、不改主页颜色 */
.cw-mask {
  display: none !important;
  pointer-events: none !important;
}

.cw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: #1a1a1a;
  color: #f5f0e8;
}
.cw-head-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cw-avatar {
  width: 78px; height: 28px; border-radius: 999px;
  background: transparent; color: #f5f0e8;
  display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
}
.cw-avatar svg {
  display: block;
  width: 72px;
  height: 18px;
}
.cw-head-text { min-width: 0; }
.cw-title { font: 600 15px/1.2 "Noto Serif SC", serif; }
.cw-sub { margin-top: 2px; font: 400 11px/1.2 "Public Sans", sans-serif; opacity: .7; }
.cw-head-phone {
  display: inline-block;
  margin-top: 4px;
  color: #d4b87a;
  font: 500 12px/1.2 "Public Sans", sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.cw-head-phone:hover { text-decoration: underline; text-underline-offset: 2px; }
.cw-close {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 32px; height: 32px; border-radius: 999px; font-size: 20px; line-height: 1;
}
.cw-close:hover { background: rgba(255,255,255,.08); }

.cw-msgs {
  flex: 1;
  overflow: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #f3eee6, #faf7f2 40%);
}
.cw-bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  font: 400 13.5px/1.55 "Noto Serif SC", "Public Sans", serif;
  white-space: pre-wrap;
  word-break: break-word;
}
.cw-bubble.is-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(28,25,23,.06);
  box-shadow: 0 4px 14px rgba(0,0,0,.04);
}
.cw-bubble.is-user {
  align-self: flex-end;
  background: #1a1a1a;
  color: #f5f0e8;
}
.cw-bubble.is-sys {
  align-self: center;
  background: transparent;
  color: rgba(28,25,23,.5);
  font-size: 12px;
  padding: 2px 0;
}
.cw-typing { opacity: .6; font-style: italic; }

.cw-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
}
.cw-chip {
  border: 1px solid rgba(28,25,23,.12);
  background: #fff;
  color: #1c1917;
  border-radius: 999px;
  padding: 6px 10px;
  font: 400 12px/1 "Public Sans", sans-serif;
  cursor: pointer;
}
.cw-chip:hover { border-color: #c4a882; color: #6b5237; }

.cw-lead {
  margin: 0 14px 10px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(196,168,130,.45);
}
.cw-lead h4 {
  margin: 0 0 8px;
  font: 600 13px/1.3 "Noto Serif SC", serif;
}
.cw-lead p {
  margin: 0 0 10px;
  font: 400 12px/1.45 "Public Sans", sans-serif;
  color: rgba(28,25,23,.65);
}
.cw-lead input, .cw-lead select {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  border: 1px solid rgba(28,25,23,.12);
  border-radius: 10px;
  padding: 9px 10px;
  font: 400 13px/1.3 "Public Sans", sans-serif;
  background: #faf7f2;
}
.cw-lead-actions { display: flex; gap: 8px; }
.cw-lead button {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
  font: 600 13px/1 "Public Sans", sans-serif;
}
.cw-lead .cw-lead-submit { background: #1a1a1a; color: #f5f0e8; }
.cw-lead .cw-lead-skip { background: transparent; color: rgba(28,25,23,.55); border: 1px solid rgba(28,25,23,.12); }

.cw-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(28,25,23,.06);
  background: #fff;
}
.cw-input input {
  flex: 1;
  border: 1px solid rgba(28,25,23,.12);
  border-radius: 999px;
  padding: 11px 14px;
  font: 400 13.5px/1.3 "Public Sans", sans-serif;
  background: #faf7f2;
}
.cw-input button {
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: #1a1a1a;
  color: #f5f0e8;
  font: 600 13px/1 "Public Sans", sans-serif;
  cursor: pointer;
}
.cw-input button:disabled { opacity: .45; cursor: wait; }

@media (max-width: 720px) {
  .cw-panel {
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .cw-panel.is-open ~ .cw-fab {
    display: none !important;
  }
  .cw-head {
    padding: max(12px, env(safe-area-inset-top, 0px)) 12px 12px;
    gap: 8px;
  }
  .cw-avatar {
    width: 64px;
    height: 24px;
  }
  .cw-avatar svg {
    width: 60px;
    height: 16px;
  }
  .cw-title { font-size: 16px; }
  .cw-sub { font-size: 12px; }
  .cw-head-phone { font-size: 13px; }
  .cw-close {
    width: 44px;
    height: 44px;
    font-size: 26px;
    flex-shrink: 0;
  }
  .cw-msgs {
    padding: 16px 16px 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .cw-bubble {
    max-width: 92%;
    font-size: 15px;
    line-height: 1.6;
    padding: 12px 14px;
  }
  .cw-quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 4px 16px 12px;
    scrollbar-width: none;
  }
  .cw-quick::-webkit-scrollbar { display: none; }
  .cw-chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    font-size: 13px;
  }
  .cw-input {
    gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .cw-input input {
    min-width: 0;
    min-height: 48px;
    font-size: 16px;
  }
  .cw-input button {
    min-width: 64px;
    min-height: 48px;
    padding: 0 16px;
    font-size: 15px;
    flex-shrink: 0;
  }
  .cw-fab {
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
  }
  .cw-fab-mark {
    width: 84px;
    height: 32px;
    padding: 0 7px 0 8px;
  }
  .cw-fab-logo {
    width: 58px;
    height: 15px;
  }
}
