/* 利辰 · 官网轻量游荡 + 主动招呼（无第三方依赖） */
.lichen-proactive {
  --lichen-ink: #3f1d6e;
  --lichen-deep: #552d8a;
  --lichen-mist: #f5f2fb;
  --lichen-line: #e4dcf0;
  --lichen-text: #1a1430;
  --lichen-size: 3.25rem;
  position: fixed;
  z-index: 45;
  left: 0;
  top: 0;
  width: var(--lichen-size);
  height: var(--lichen-size);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transform: translate3d(var(--lichen-x, 1rem), var(--lichen-y, 70vh), 0);
  transition: transform 4.5s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-tap-highlight-color: transparent;
}

.lichen-proactive:focus-visible {
  outline: 2px solid var(--lichen-ink);
  outline-offset: 4px;
  border-radius: 999px;
}

.lichen-proactive__avatar {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  box-shadow:
    0 10px 28px rgba(26, 20, 48, 0.18),
    0 0 0 2px rgba(255, 255, 255, 0.9);
  overflow: hidden;
  background: var(--lichen-ink);
  display: grid;
  place-items: center;
  animation: lichen-bob 3.6s ease-in-out infinite;
}

.lichen-proactive__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  display: block;
}

.lichen-proactive__bubble {
  position: absolute;
  right: calc(100% + 0.65rem);
  bottom: 0;
  width: min(16.5rem, calc(100vw - 5.5rem));
  padding: 0.85rem 0.95rem 0.9rem;
  border-radius: 1rem 1rem 0.35rem 1rem;
  background: rgba(255, 255, 255, 0.97);
  color: var(--lichen-text);
  border: 1px solid var(--lichen-line);
  box-shadow: 0 16px 36px rgba(26, 20, 48, 0.14);
  text-align: left;
  font: 0.875rem/1.45 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.35rem) scale(0.98);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
}

.lichen-proactive.is-bubble-open .lichen-proactive__bubble {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.lichen-proactive__bubble[data-side="right"] {
  right: auto;
  left: calc(100% + 0.65rem);
  border-radius: 1rem 1rem 1rem 0.35rem;
}

.lichen-proactive__name {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--lichen-ink);
}

.lichen-proactive__text {
  margin: 0 0 0.75rem;
  color: var(--lichen-text);
}

.lichen-proactive__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.lichen-proactive__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--lichen-ink), #5b8fd4);
  color: #fff !important;
  font-weight: 600;
  font-size: 0.8125rem;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
}

.lichen-proactive__cta:hover {
  filter: brightness(1.05);
}

.lichen-proactive__later {
  appearance: none;
  border: 1px solid var(--lichen-line);
  background: var(--lichen-mist);
  color: var(--lichen-deep);
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.lichen-proactive__later:hover {
  border-color: var(--lichen-ink);
}

/* —— 站内客服面板 —— */
.lichen-proactive__hit {
  all: unset;
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.lichen-proactive__panel {
  position: absolute;
  right: calc(100% + 0.65rem);
  bottom: 0;
  width: min(20.5rem, calc(100vw - 4.5rem));
  height: min(28rem, calc(100vh - 5.5rem));
  display: flex;
  flex-direction: column;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.98);
  color: var(--lichen-text);
  border: 1px solid var(--lichen-line);
  box-shadow: 0 20px 44px rgba(26, 20, 48, 0.18);
  font: 0.875rem/1.45 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.4rem) scale(0.98);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
  overflow: hidden;
  text-align: left;
}

.lichen-proactive__panel[data-side="right"] {
  right: auto;
  left: calc(100% + 0.65rem);
}

.lichen-proactive.is-panel-open .lichen-proactive__panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.lichen-proactive.is-panel-open {
  transition: transform 0.35s ease;
}

.lichen-proactive__panel-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem 0.55rem 0.55rem;
  border-bottom: 1px solid var(--lichen-line);
  background: linear-gradient(135deg, #f7f4fc, #eef4fb);
}

.lichen-proactive__panel-body {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  overflow: visible;
  background: transparent;
  perspective: 640px;
}

.lichen-proactive__panel-face {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%;
  display: block;
  border-radius: 16px;
}

/* 与 /m 同源存在感身体 */
.lichen-body--presence {
  position: relative;
  isolation: isolate;
  transform-style: preserve-3d;
}
.lichen-body__glow {
  position: absolute;
  inset: -8%;
  border-radius: 22px;
  background:
    radial-gradient(circle at 42% 28%, rgba(91, 143, 212, 0.32), transparent 52%),
    radial-gradient(circle at 70% 85%, rgba(63, 29, 110, 0.2), transparent 48%);
  z-index: 0;
  pointer-events: none;
}
.lichen-body__ring {
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  border: 1.5px solid rgba(63, 29, 110, 0.22);
  z-index: 1;
  pointer-events: none;
}
.lichen-body--working .lichen-body__ring,
.lichen-body[data-mood="working"] .lichen-body__ring {
  border-color: rgba(91, 143, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 143, 212, 0.16);
}
.lichen-body__card {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #1a1430;
  box-shadow: 0 10px 22px rgba(26, 20, 48, 0.16);
  will-change: transform;
}
.lichen-body__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 10%;
  display: block;
}
.lichen-body__dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 3;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2f9e6a;
  border: 2px solid #fff;
}

.lichen-proactive__panel-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.lichen-proactive__panel-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--lichen-ink);
  letter-spacing: 0.02em;
}

.lichen-proactive__panel-status {
  font-size: 0.7rem;
  color: var(--lichen-deep);
  opacity: 0.85;
}

.lichen-proactive__panel-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--lichen-deep);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
}

.lichen-proactive__panel-close:hover {
  background: rgba(63, 29, 110, 0.08);
}

.lichen-proactive__msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.lichen-proactive__msg {
  max-width: 92%;
  padding: 0.55rem 0.7rem;
  border-radius: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.lichen-proactive__msg--bot {
  align-self: flex-start;
  background: var(--lichen-mist);
  color: var(--lichen-text);
  border-bottom-left-radius: 0.25rem;
}

.lichen-proactive__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--lichen-ink), #5b8fd4);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.lichen-proactive__match-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--lichen-ink);
}

.lichen-proactive__loc {
  margin: 0;
  white-space: pre-wrap;
}

.lichen-proactive__zh {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--lichen-deep);
  opacity: 0.88;
  white-space: pre-wrap;
}

.lichen-proactive__match-list {
  margin: 0;
  padding-left: 1.1rem;
}

.lichen-proactive__match-list a {
  color: var(--lichen-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lichen-proactive__cards {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.lichen-proactive__card {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0.55rem;
  align-items: center;
  padding: 0.35rem;
  border-radius: 0.65rem;
  border: 1px solid var(--lichen-line);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lichen-proactive__card:hover {
  border-color: var(--lichen-ink);
  background: var(--lichen-mist);
}

.lichen-proactive__card img {
  width: 3.25rem;
  height: 3.25rem;
  object-fit: cover;
  border-radius: 0.45rem;
  background: var(--lichen-mist);
}

.lichen-proactive__card-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.lichen-proactive__card-body strong {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--lichen-text);
  line-height: 1.3;
}

.lichen-proactive__card-body em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--lichen-deep);
}

.lichen-proactive__fee {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--lichen-deep);
  opacity: 0.9;
}

.lichen-proactive__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.85rem 0.55rem;
}

.lichen-proactive__chip {
  appearance: none;
  border: 1px solid var(--lichen-line);
  background: #fff;
  color: var(--lichen-deep);
  font: inherit;
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
}

.lichen-proactive__chip:hover {
  border-color: var(--lichen-ink);
  background: var(--lichen-mist);
}

.lichen-proactive__composer {
  display: none;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem 0.75rem;
  border-top: 1px solid var(--lichen-line);
  background: #fff;
}
.lichen-proactive__composer.is-open {
  display: flex;
}

.lichen-proactive__composer input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--lichen-line);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  color: var(--lichen-text);
  background: var(--lichen-mist);
}

.lichen-proactive__composer input:focus {
  outline: 2px solid rgba(63, 29, 110, 0.25);
  outline-offset: 1px;
}

.lichen-proactive__send {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: var(--lichen-ink);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.lichen-proactive__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0.85rem 0.85rem;
  align-items: center;
}

@keyframes lichen-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@media (max-width: 520px) {
  .lichen-proactive {
    --lichen-size: 2.85rem;
  }

  .lichen-proactive__bubble {
    width: min(14.5rem, calc(100vw - 4.75rem));
    font-size: 0.8125rem;
  }

  .lichen-proactive__panel {
    position: fixed;
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: 4.5rem;
    width: auto;
    height: min(70vh, 28rem);
    transform-origin: bottom center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lichen-proactive {
    transition: none !important;
  }

  .lichen-proactive__avatar {
    animation: none !important;
  }

  .lichen-proactive__bubble {
    transition: opacity 0.15s ease, visibility 0.15s !important;
    transform: none !important;
  }
}
