/*!
 * lx-ai-chat — front-end widget stylesheet
 * Plugin : lx-ai-chat  ·  Ver 1.0.3
 * Target : https://lxcomposites.com/  (WP 7.1.3 / Astra 4.14.0 / LiteSpeed Cache / TranslatePress)
 *
 * RULES FOR WHOEVER EDITS THIS FILE
 *  1. Every selector is prefixed `.lx-chat-` (root) or `.lx-bot-` (inside mascot.svg).
 *     Never style bare `button` / `input` / `a` — Astra will fight you and win on specificity.
 *  2. No @font-face, no @import, no url() to external hosts. Font is inherited from
 *     <body> via `font-family: inherit`.
 *  3. All widget DOM is created by lx-chat.js at runtime (LiteSpeed caches anonymous
 *     HTML — a static container would be baked into the cache page). This file only
 *     styles what that script inserts.
 *  4. z-index ceiling is 99999: above Astra's highest layer (sticky header / mobile
 *     drawer use < 1000), well below the 2147483647 that browser extensions occupy.
 */

/* ==========================================================================
   0. Design tokens
   ========================================================================== */

.lx-chat-root {
  /* --- brand (from logo, frozen — do not introduce new hues) --- */
  --lx-cyan:      #29ABE2;   /* bright cyan  — accent, ring, filament tips  */
  --lx-blue:      #1E7CC8;   /* mid blue     — gradients, hover              */
  --lx-navy:      #124E8C;   /* deep blue    — primary solid, text, links    */
  --lx-navy-700:  #0E3D6F;   /* hover of primary                             */
  --lx-navy-800:  #0A2E54;   /* active of primary                            */
  --lx-navy-050:  #E8F4FD;   /* info / selected chip background             */

  /* --- neutral ramp (slate, cool enough to sit next to the blues) --- */
  --lx-n-000: #FFFFFF;
  --lx-n-050: #F8FAFC;
  --lx-n-100: #F1F5F9;   /* bot bubble background */
  --lx-n-200: #E2E8F0;   /* borders, hairlines    */
  --lx-n-300: #CBD5E1;
  --lx-n-400: #94A3B8;   /* disabled text only    */
  --lx-n-500: #64748B;   /* placeholder           */
  --lx-n-600: #475569;   /* secondary text, meta  */
  --lx-n-700: #334155;
  --lx-n-800: #1E293B;   /* body text             */

  /* --- semantic --- */
  --lx-success:      #157538;  --lx-success-bg: #E7F6EE;   /* 5.18:1 */
  --lx-warning:      #B45309;  --lx-warning-bg: #FEF6E7;
  --lx-danger:       #B3261E;  --lx-danger-bg:  #FDECEC;
  --lx-info:         #124E8C;  --lx-info-bg:    #E8F4FD;

  /* --- radius --- */
  --lx-r-sm: 4px;  --lx-r-md: 8px;  --lx-r-lg: 12px;
  --lx-r-xl: 16px; --lx-r-2xl: 20px; --lx-r-full: 999px;

  /* --- spacing (4-based) --- */
  --lx-s-1: 4px;  --lx-s-2: 8px;  --lx-s-3: 12px;
  --lx-s-4: 16px; --lx-s-5: 20px; --lx-s-6: 24px; --lx-s-8: 32px;

  /* --- elevation --- */
  --lx-sh-1: 0 1px 3px rgba(15, 23, 42, .10), 0 1px 2px rgba(15, 23, 42, .06);
  --lx-sh-2: 0 6px 16px rgba(18, 78, 140, .28);
  --lx-sh-3: 0 18px 48px rgba(15, 23, 42, .24);

  /* --- motion --- */
  --lx-t-instant: 80ms;
  --lx-t-fast:    160ms;
  --lx-t-base:    240ms;
  --lx-t-slow:    320ms;
  --lx-e-std:  cubic-bezier(.2, .8, .2, 1);
  --lx-e-back: cubic-bezier(.18, .89, .32, 1.28);
  --lx-e-out:  cubic-bezier(.4, 0, 1, 1);

  /* --- geometry (overridden per breakpoint, see §6) --- */
  --lx-fab:      56px;
  --lx-gap:      16px;
  --lx-panel-w:  100vw;
  --lx-panel-h:  100vh;
  --lx-panel-r:  0px;
  --lx-z:        99999;
  /* 页脚避让：页脚进入视口时 root 上移量，默认 0（不避让）。
     lx-chat.js 按 DOM 实测写入：页脚含 LinkedIn 社交行时为
     「社交行距页脚底高度 - gap + 12px 余量」；页脚无 LinkedIn 时为 0。 */
  --lx-fab-lift: 0px;
}

/* ==========================================================================
   1. Root shell  (created by JS — must carry translate="no" + .notranslate)
   ========================================================================== */

.lx-chat-root,
.lx-chat-root *,
.lx-chat-root *::before,
.lx-chat-root *::after { box-sizing: border-box; }

.lx-chat-root {
  position: fixed;
  right: var(--lx-gap);
  /* iOS 安全区：bottom 含 env(safe-area-inset-bottom)，FAB 不压 Home 指示条 */
  bottom: calc(var(--lx-gap) + env(safe-area-inset-bottom, 0px));
  z-index: var(--lx-z);
  display: block;
  width: var(--lx-fab);
  height: var(--lx-fab);
  font-family: inherit;          /* site sans — no new font loaded */
  font-size: 15px;
  line-height: 1.65;
  color: var(--lx-n-800);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* 页脚避让时 bottom 平滑过渡（reduced-motion 下被 §7 压成瞬时） */
  transition: bottom var(--lx-t-fast) var(--lx-e-std);
}

/* Accessibility: visible focus ring on every interactive element */
.lx-chat-root :focus-visible {
  outline: 3px solid var(--lx-cyan);
  outline-offset: 2px;
  border-radius: var(--lx-r-sm);
}
.lx-chat-root :focus:not(:focus-visible) { outline: none; }

/* Screen-reader-only text (also used for the aria-live announcer) */
.lx-chat-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   2. Launcher — greeting bubble + floating action button
   ========================================================================== */

.lx-chat-launcher {
  position: absolute;
  inset: 0;
  transition: opacity var(--lx-t-fast) var(--lx-e-std),
              transform var(--lx-t-fast) var(--lx-e-std),
              visibility 0s linear var(--lx-t-fast);
}

/* launcher hides while the panel is open */
.lx-chat-root.is-open .lx-chat-launcher {
  opacity: 0;
  visibility: hidden;
  transform: scale(.82);
  pointer-events: none;
  transition-delay: 0s;
}

/* --------------------------------- 页脚避让 --------------------------------
   2026-10-23：站点页脚进入视口时，lx-chat.js 给 root 加 .is-near-footer
   并按 DOM 实测写入 --lx-fab-lift（避开页脚社交行/LinkedIn 图标所需的上移量）。
   页脚内没有 LinkedIn 链接时实测值为 0 —— 不上移（无社交图标可避，
   强行上移只会把 FAB 推进浮动联系条等其他固定组件，制造新的遮挡）。
   root 整体上移（FAB + 问候气泡 + 命中区一起走，不留透明点击死区）。
   - .is-entering：入场 dock 动画期间不参与，避免与动画争 transform/位置；
   - .is-open：面板展开态不参与（面板为全屏/大面板，不与页脚冲突）；
   - reduced-motion：§7 blanket 规则把过渡压成瞬时（root 自身已纳入该选择器）。 */
.lx-chat-root.is-near-footer:not(.is-entering):not(.is-open) {
  bottom: calc(var(--lx-gap) + env(safe-area-inset-bottom, 0px) + var(--lx-fab-lift));
}

/* --------------------------------- FAB ----------------------------------- */

.lx-chat-fab {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: auto;
  min-width: var(--lx-fab);
  height: var(--lx-fab);
  padding: 0 18px 0 6px;
  margin: 0; border: 0;
  border-radius: var(--lx-r-full);
  background: linear-gradient(140deg, #1E7CC8 0%, #124E8C 100%);
  box-shadow: var(--lx-sh-2);
  color: #FFFFFF;
  cursor: pointer;
  overflow: hidden;                        /* crops the mascot's shoulders */
  -webkit-appearance: none;
  appearance: none;
  transition: transform var(--lx-t-fast) var(--lx-e-std),
              box-shadow var(--lx-t-fast) var(--lx-e-std);
}

/* 2026-11-06: 头像做成固定圆形裁切框，胶囊变宽时头像尺寸不变 */
.lx-chat-fab__avatar {
  flex: 0 0 auto;
  width: calc(var(--lx-fab) - 12px);
  height: calc(var(--lx-fab) - 12px);
  border-radius: 50%;
  overflow: hidden;
  display: block;
  background: rgba(255, 255, 255, .14);
}

.lx-chat-fab__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .01em;
  color: #FFFFFF;
  white-space: nowrap;
  pointer-events: none;
}

/* 小屏（<=420px）：胶囊略收，避免占掉正文右侧三分之一 */
@media (max-width: 420px) {
  .lx-chat-fab        { padding: 0 14px 0 5px; gap: 7px; }
  .lx-chat-fab__label { font-size: 13px; }
  .lx-chat-greeting   { max-width: 82vw; }
}

/* 手机端回到 56px 圆形按钮：站点浮动联系条在手机端是横排（从 right:88px 往左），
   胶囊一宽就和 LinkedIn / WhatsApp 那一行压在一起。文字信息交给上方的问候气泡。 */
@media (max-width: 767px) {
  .lx-chat-fab        { width: var(--lx-fab); padding: 0; gap: 0; justify-content: center; }
  .lx-chat-fab__label { display: none; }
}

/* 1px cyan rim so the tri-colour brand story survives at 56px */
.lx-chat-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(41, 171, 226, .55);
  pointer-events: none;
}

.lx-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(18, 78, 140, .36);
}
.lx-chat-fab:active { transform: translateY(0) scale(.94); }

/* The mascot file is 120x120; this transform frames head + antenna only. */
.lx-chat-fab__mascot {
  width: 100%;
  height: 100%;
  display: block;
  transform: translateY(12%) scale(1.2);
  pointer-events: none;
}

/* idle breathing on the button itself */
.lx-chat-root.is-idle .lx-chat-fab { animation: lx-chat-breathe 3.8s ease-in-out infinite; }
@keyframes lx-chat-breathe {
  0%, 100% { box-shadow: var(--lx-sh-2); }
  50%      { box-shadow: 0 6px 22px rgba(18, 78, 140, .42); }
}

/* unread dot */
.lx-chat-fab__badge {
  position: absolute;
  top: 5px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-radius: var(--lx-r-full);
  background: var(--lx-cyan);
  border: 2px solid var(--lx-n-000);
  box-shadow: var(--lx-sh-1);
}
.lx-chat-fab__badge[hidden] { display: none; }

/* --------------------------- greeting bubble ---------------------------- */

.lx-chat-greeting {
  position: absolute;
  right: 0;
  bottom: calc(var(--lx-fab) + 10px);
  width: max-content;
  max-width: min(86vw, 320px);
  padding: 12px 16px;
  border-radius: var(--lx-r-xl);
  background: var(--lx-n-000);
  color: var(--lx-n-800);
  filter: drop-shadow(0 12px 28px rgba(15, 23, 42, .22));
  opacity: 0;
  pointer-events: none;
  transform-origin: 100% 100%;
  transition: opacity 320ms var(--lx-e-std), transform 320ms var(--lx-e-std);
}

/* tail — built from a border triangle so drop-shadow() stays clean.
   2026-11-06: FAB 变胶囊后气泡改到按钮上方，尾巴朝下对齐头像一侧。 */
.lx-chat-greeting::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 100%;
  width: 0; height: 0;
  border: 7px solid transparent;
  border-bottom-width: 0;
  border-top-color: var(--lx-n-000);
  transform: none;
}

.lx-chat-greeting__title {
  display: block;
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--lx-n-800);
}
.lx-chat-greeting__body {
  display: block;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--lx-n-600);
}
.lx-chat-greeting__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px; height: 24px;
  border: 0; padding: 0;
  background: transparent;
  color: var(--lx-n-500);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--lx-r-sm);
}
.lx-chat-greeting__close:hover { color: var(--lx-n-800); }

/* ==========================================================================
   3. Entrance animation timeline (desktop only, first visit only)
      0ms      mounted, parked off-canvas right at vertical centre, opacity 0
      1200ms   slide-in starts  (520ms, overshoot ease)
      1290ms   overshoot peak: translateX(-8px) scale(1.04)
      1600ms   greeting bubble starts fading in (320ms)
      1720ms   slide-in settled at right-centre
      1920ms   greeting fully visible
      2700ms   greeting fades out (300ms) + launcher docks to bottom-right (480ms)
      3000ms   greeting gone
      3180ms   docking done — widget is now the resident FAB
      JS must strip `.is-entering` at 3200ms so :hover transform works again.
   ========================================================================== */

/* Park the launcher at the vertical centre of the viewport. The FAB centre
   normally sits (gap + fab/2) = 84px above the bottom edge, so the offset to
   the viewport centre is ((gap + fab/2) - 50vh) — negative, i.e. move up. */
.lx-chat-root.is-entering .lx-chat-launcher {
  animation: lx-chat-dock 480ms var(--lx-e-std) 2700ms backwards;
}
@keyframes lx-chat-dock {
  from { transform: translateY(calc((var(--lx-gap) + var(--lx-fab) / 2) - 50vh)); }
  to   { transform: translateY(0); }
}

.lx-chat-root.is-entering .lx-chat-fab {
  animation: lx-chat-slide-in 520ms var(--lx-e-back) 1200ms backwards;
}
@keyframes lx-chat-slide-in {
  0%   { opacity: 0; transform: translateX(140%) scale(.86); }
  17%  { opacity: 1; transform: translateX(-8px)  scale(1.04); }
  38%  { transform: translateX(2px)   scale(.99); }
  100% { opacity: 1; transform: translateX(0)     scale(1); }
}

/* 2026-11-06：气泡显隐改由 JS 的 .is-greeting 驱动。
   旧写法用写死的时间轴（2.7s 淡出），JS 后来把入场延迟调到 2.5s，
   结果 CSS 已经淡出、JS 才刚把它显示出来 —— 气泡永远是透明的。 */
.lx-chat-root.is-greeting .lx-chat-greeting {
  opacity: 1;
  transform: translateY(-4px);
  pointer-events: auto;
}

/* ==========================================================================
   4. Panel
   ========================================================================== */

.lx-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(var(--lx-fab) + var(--lx-s-3));
  width: var(--lx-panel-w);
  height: var(--lx-panel-h);
  display: flex;
  flex-direction: column;
  background: var(--lx-n-000);
  border-radius: var(--lx-panel-r);
  box-shadow: var(--lx-sh-3);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.98);
  transform-origin: 100% 100%;
  transition: opacity var(--lx-t-base) var(--lx-e-std),
              transform var(--lx-t-base) var(--lx-e-std),
              visibility 0s linear var(--lx-t-base);
}

.lx-chat-root.is-open .lx-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

/* ------------------------------- header ---------------------------------- */

.lx-chat-panel__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--lx-s-3);
  padding: 12px 10px 12px 16px;
  color: #FFFFFF;
  background: var(--lx-navy);                       /* solid: 8.42:1 with white */
  border-top: 3px solid var(--lx-cyan);             /* decorative accent stripe   */
}

.lx-chat-panel__mascot {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 3px;
  border-radius: var(--lx-r-full);
  background: rgba(255, 255, 255, .16);
  display: block;
  pointer-events: none;
}

.lx-chat-panel__titles { flex: 1 1 auto; min-width: 0; }

.lx-chat-panel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #FFFFFF;
}
.lx-chat-panel__subtitle {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  color: #E7EDF3;                 /* 7.16:1 on #124E8C */
}

/* 24px glyph box, 44px invisible hit area (WCAG 2.5.8) */
.lx-chat-iconbtn {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0; padding: 0; border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--lx-r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color var(--lx-t-fast) var(--lx-e-std),
              color var(--lx-t-fast) var(--lx-e-std);
}
.lx-chat-iconbtn::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
}
.lx-chat-panel__header .lx-chat-iconbtn { color: rgba(255, 255, 255, .88); }
.lx-chat-panel__header .lx-chat-iconbtn:hover {
  background: rgba(255, 255, 255, .16);
  color: #FFFFFF;
}
.lx-chat-composer .lx-chat-iconbtn { color: var(--lx-n-600); }
.lx-chat-composer .lx-chat-iconbtn:hover {
  background: var(--lx-n-100);
  color: var(--lx-navy);
}
.lx-chat-iconbtn[disabled] { color: var(--lx-n-400); cursor: not-allowed; }

/* -------------------------------- log ------------------------------------ */

.lx-chat-log {
  flex: 1 1 auto;
  min-height: 0;                    /* required or flex child won't scroll */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--lx-s-4);
  background: var(--lx-n-000);
  display: flex;
  flex-direction: column;
  gap: var(--lx-s-3);
}

/* ------------------------------ messages --------------------------------- */

.lx-chat-msg {
  display: flex;
  align-items: flex-end;
  gap: var(--lx-s-2);
  max-width: 100%;
}
.lx-chat-msg--user { flex-direction: row-reverse; }

.lx-chat-msg__avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: var(--lx-r-full);
  overflow: hidden;
  background: var(--lx-navy);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lx-chat-msg__avatar img,
.lx-chat-msg__avatar svg { width: 100%; height: 100%; display: block; }
.lx-chat-msg--user .lx-chat-msg__avatar {
  background: var(--lx-n-200);
  color: var(--lx-n-600);
  font-size: 11px;
  font-weight: 600;
}

.lx-chat-msg__col {
  min-width: 0;
  max-width: calc(100% - 36px);
  display: flex;
  flex-direction: column;
  gap: var(--lx-s-1);
}
.lx-chat-msg--user .lx-chat-msg__col { align-items: flex-end; }

.lx-chat-msg__bubble {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--lx-r-xl);
  font-size: 15px;
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* bot: light slate on white — 13.35:1 */
.lx-chat-msg--bot .lx-chat-msg__bubble {
  background: var(--lx-n-100);
  color: var(--lx-n-800);
  border-bottom-left-radius: var(--lx-r-sm);
}

/* visitor: solid navy, white text — 8.42:1 */
.lx-chat-msg--user .lx-chat-msg__bubble {
  background: var(--lx-navy);
  color: #FFFFFF;
  border-bottom-right-radius: var(--lx-r-sm);
}

/* minimal rich text returned by the server (reply_html, wp_kses_post) */
.lx-chat-msg__bubble b,
.lx-chat-msg__bubble strong { font-weight: 600; }
.lx-chat-msg__bubble ul { margin: 4px 0; padding-left: 20px; }
.lx-chat-msg__bubble li { margin: 2px 0; }
.lx-chat-msg__bubble a { color: var(--lx-navy); text-decoration: underline; }
.lx-chat-msg--user .lx-chat-msg__bubble a { color: #FFFFFF; }

.lx-chat-msg__meta {
  font-size: 12px;
  line-height: 1.5;
  color: var(--lx-n-600);          /* 6.92:1 on bot bubble bg */
  padding: 0 4px;
}

/* image inside a message */
.lx-chat-msg__image {
  position: relative;
  display: block;
  max-width: 200px;
  border-radius: var(--lx-r-lg);
  overflow: hidden;
  background: var(--lx-n-100);
  cursor: zoom-in;
}
.lx-chat-msg__image img {
  display: block;
  width: 100%;
  height: auto;
}
.lx-chat-msg__image--uploading { cursor: progress; }
.lx-chat-msg__image--uploading img { opacity: .45; filter: blur(1px); }

.lx-chat-msg__image-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--lx-s-1);
  font-size: 12px;
  font-weight: 500;
  color: var(--lx-n-700);
}
.lx-chat-msg__image--failed .lx-chat-msg__image-status { color: var(--lx-danger); }

/* spinner */
.lx-chat-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(18, 78, 140, .25);
  border-top-color: var(--lx-navy);
  border-radius: var(--lx-r-full);
  animation: lx-chat-spin 720ms linear infinite;
}
@keyframes lx-chat-spin { to { transform: rotate(360deg); } }

/* ------------------------- typing indicator ------------------------------ */

.lx-chat-typing {
  display: flex;
  align-items: center;
  gap: var(--lx-s-1);
  padding: 12px 14px;
  width: max-content;
  border-radius: var(--lx-r-xl);
  border-bottom-left-radius: var(--lx-r-sm);
  background: var(--lx-n-100);
}
.lx-chat-typing span {
  width: 7px; height: 7px;
  border-radius: var(--lx-r-full);
  background: var(--lx-blue);      /* 4.02:1 on #F1F5F9 — non-text graphic */
  animation: lx-chat-dot 1.25s ease-in-out infinite;
}
.lx-chat-typing span:nth-child(2) { animation-delay: .16s; }
.lx-chat-typing span:nth-child(3) { animation-delay: .32s; }
@keyframes lx-chat-dot {
  0%, 60%, 100% { transform: translateY(0);    opacity: .45; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* --------------------------- followup chips ----------------------------- */

.lx-chat-followups {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-s-2);
  padding-left: 36px;              /* align with bubble column */
}
.lx-chat-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  margin: 0;
  border: 1px solid var(--lx-n-200);
  border-radius: var(--lx-r-full);
  background: var(--lx-n-000);
  color: var(--lx-navy);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--lx-t-fast) var(--lx-e-std),
              border-color var(--lx-t-fast) var(--lx-e-std),
              color var(--lx-t-fast) var(--lx-e-std);
}
.lx-chat-chip:hover {
  background: var(--lx-navy-050);
  border-color: var(--lx-blue);
  color: var(--lx-navy-700);
}
.lx-chat-chip:active { transform: translateY(1px); }
.lx-chat-chip[disabled] {
  color: var(--lx-n-400);
  border-color: var(--lx-n-200);
  background: var(--lx-n-050);
  cursor: not-allowed;
}

/* ------------------------- satisfaction bar ------------------------------ */

.lx-chat-feedback {
  display: flex;
  flex-direction: column;
  gap: var(--lx-s-2);
  padding: 10px 12px;
  margin-left: 36px;
  border: 1px solid var(--lx-n-200);
  border-radius: var(--lx-r-lg);
  background: var(--lx-n-050);
}
.lx-chat-feedback__row {
  display: flex;
  align-items: center;
  gap: var(--lx-s-2);
  flex-wrap: wrap;
}
.lx-chat-feedback__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--lx-n-700);
  margin-right: auto;
}
.lx-chat-ratebtn {
  min-width: 44px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--lx-n-200);
  border-radius: var(--lx-r-full);
  background: var(--lx-n-000);
  color: var(--lx-n-700);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color var(--lx-t-fast) var(--lx-e-std),
              border-color var(--lx-t-fast) var(--lx-e-std),
              color var(--lx-t-fast) var(--lx-e-std);
}
.lx-chat-ratebtn:hover { border-color: var(--lx-blue); color: var(--lx-navy); }
.lx-chat-ratebtn.is-selected {
  background: var(--lx-navy);
  border-color: var(--lx-navy);
  color: #FFFFFF;
}
.lx-chat-comment {
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid var(--lx-n-200);
  border-radius: var(--lx-r-md);
  background: var(--lx-n-000);
  color: var(--lx-n-800);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}
.lx-chat-comment::placeholder { color: var(--lx-n-500); }   /* 4.76:1 */
.lx-chat-comment:focus {
  outline: 3px solid var(--lx-cyan);
  outline-offset: 0;
  border-color: var(--lx-blue);
}

/* --------------------------- system / notice ------------------------------ */

.lx-chat-system {
  align-self: center;
  max-width: 90%;
  margin: 0 auto;
  padding: 6px 12px;
  border-radius: var(--lx-r-full);
  background: var(--lx-n-100);
  color: var(--lx-n-600);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.lx-chat-notice {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: var(--lx-s-2);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border-bottom: 1px solid var(--lx-n-200);
}
.lx-chat-notice--info    { background: var(--lx-info-bg);    color: var(--lx-info); }
.lx-chat-notice--success { background: var(--lx-success-bg); color: var(--lx-success); }
.lx-chat-notice--warning { background: var(--lx-warning-bg); color: var(--lx-warning); }
.lx-chat-notice--danger  { background: var(--lx-danger-bg);  color: var(--lx-danger); }

.lx-chat-panel__footer {
  flex: 0 0 auto;
  padding: 8px 16px 10px;
  background: var(--lx-n-050);
  border-top: 1px solid var(--lx-n-200);
  font-size: 12px;
  line-height: 1.5;
  color: var(--lx-n-600);
  text-align: center;
}

/* ==========================================================================
   5. Composer
   ========================================================================== */

.lx-chat-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: var(--lx-s-2);
  padding: var(--lx-s-3);
  background: var(--lx-n-000);
  border-top: 1px solid var(--lx-n-200);
}

.lx-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 120px;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--lx-n-200);
  border-radius: var(--lx-r-lg);
  background: var(--lx-n-000);
  color: var(--lx-n-800);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
}
.lx-chat-input::placeholder { color: var(--lx-n-500); }
.lx-chat-input:focus {
  outline: none;
  border-color: var(--lx-blue);
  box-shadow: 0 0 0 3px rgba(41, 171, 226, .28);
}
.lx-chat-input[disabled] { background: var(--lx-n-050); color: var(--lx-n-400); }

/* ------------------------------- buttons --------------------------------- */

.lx-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--lx-s-2);
  min-height: 44px;
  padding: 0 16px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--lx-r-lg);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  text-transform: none;
  letter-spacing: normal;
  transition: background-color var(--lx-t-fast) var(--lx-e-std),
              border-color var(--lx-t-fast) var(--lx-e-std),
              color var(--lx-t-fast) var(--lx-e-std),
              transform var(--lx-t-fast) var(--lx-e-std);
}
.lx-chat-btn:active { transform: translateY(1px); }

.lx-chat-btn--primary {
  background: var(--lx-navy);
  border-color: var(--lx-navy);
  color: #FFFFFF;                  /* 8.42:1 */
}
.lx-chat-btn--primary:hover {
  background: var(--lx-navy-700);
  border-color: var(--lx-navy-700);
}
.lx-chat-btn--primary:active {
  background: var(--lx-navy-800);
  border-color: var(--lx-navy-800);
}

.lx-chat-btn--ghost {
  background: transparent;
  border-color: var(--lx-n-200);
  color: var(--lx-navy);
}
.lx-chat-btn--ghost:hover { background: var(--lx-navy-050); border-color: var(--lx-blue); }

.lx-chat-btn[disabled] {
  background: var(--lx-n-100);
  border-color: var(--lx-n-200);
  color: var(--lx-n-400);
  cursor: not-allowed;
  transform: none;
}

/* send button collapses to an icon square when there is nothing to send */
.lx-chat-composer .lx-chat-btn--primary {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 0 14px;
}

/* ------------------------------ turnstile -------------------------------- */

.lx-chat-turnstile {
  padding: var(--lx-s-3) var(--lx-s-4) 0;
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   6. Image preview lightbox
   ========================================================================== */

.lx-chat-preview {
  position: fixed;
  inset: 0;
  z-index: calc(var(--lx-z) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--lx-s-6);
  background: rgba(15, 23, 42, .82);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--lx-t-base) var(--lx-e-std),
              visibility 0s linear var(--lx-t-base);
}
.lx-chat-preview.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
.lx-chat-preview__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--lx-r-lg);
  box-shadow: var(--lx-sh-3);
}
.lx-chat-preview__close {
  position: absolute;
  top: var(--lx-s-4);
  right: var(--lx-s-4);
  width: 44px; height: 44px;
  border: 0;
  border-radius: var(--lx-r-full);
  background: rgba(255, 255, 255, .14);
  color: #FFFFFF;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.lx-chat-preview__close:hover { background: rgba(255, 255, 255, .26); }

/* ==========================================================================
   7. Reduced-motion degradation
      Entrance is skipped entirely: the widget appears docked bottom-right as a
      plain button. All looping motion (breathing, blink, mouth, spinner) is
      reduced to a single, near-instant pass.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .lx-chat-root,
  .lx-chat-root *,
  .lx-chat-root *::before,
  .lx-chat-root *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
  }
  .lx-chat-root.is-entering .lx-chat-launcher,
  .lx-chat-root.is-entering .lx-chat-fab {
    animation: none !important;
    transform: none !important;
  }
  .lx-chat-root.is-entering .lx-chat-greeting {
    animation: none !important;
    opacity: 0 !important;
  }
  /* keep the spinner legible even with the blanket rule above */
  .lx-chat-spinner { border-top-color: var(--lx-navy); }
}

/* ==========================================================================
   8. Responsive
      Mobile-first. Tablet/desktop only change the tokens declared in §0 —
      no selector duplication.
   ========================================================================== */

/* ---------- base: mobile, < 768px -----------------------------------------
   Panel is a full-screen sheet. No entrance animation (JS never adds
   `.is-entering` below 768px); the FAB is resident from first paint.        */
.lx-chat-panel {
  position: fixed;
  inset: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;                  /* avoids the iOS URL-bar jump */
  border-radius: 0;
}
.lx-chat-log              { padding: var(--lx-s-3); gap: var(--lx-s-2); }
.lx-chat-msg__bubble      { font-size: 14px; }
.lx-chat-input            { font-size: 14px; }
.lx-chat-followups        { padding-left: 0; }
.lx-chat-feedback         { margin-left: 0; }
.lx-chat-greeting         { max-width: min(74vw, 260px); }

/* ---------- tablet: >= 768px -------------------------------------------- */
@media (min-width: 768px) {
  .lx-chat-root {
    --lx-fab:     60px;
    --lx-gap:     24px;
    /* 2026-11-06：右边缘与站点浮动联系条（right:10px）对齐，形成一条竖排 dock */
    right:        10px;
    --lx-panel-w: 380px;
    --lx-panel-h: 560px;
    --lx-panel-r: 20px;
  }
  .lx-chat-panel {
    position: absolute;
    inset: auto;
    right: 0;
    bottom: calc(var(--lx-fab) + var(--lx-s-3));
    width: var(--lx-panel-w);
    height: var(--lx-panel-h);
    border-radius: var(--lx-panel-r);
  }
  .lx-chat-log         { padding: var(--lx-s-4); gap: var(--lx-s-3); }
  .lx-chat-msg__bubble { font-size: 15px; }
  .lx-chat-input       { font-size: 15px; }
  .lx-chat-followups   { padding-left: 36px; }
  .lx-chat-feedback    { margin-left: 36px; }
  /* 2026-11-06：桌面端气泡让开右侧那列 46px 圆图标（LinkedIn / WhatsApp），
     否则 8 秒的入场气泡会正好盖住它们。 */
  .lx-chat-greeting    { max-width: 300px; right: 56px; }
}

/* ---------- desktop: >= 1024px ------------------------------------------ */
@media (min-width: 1024px) {
  .lx-chat-root {
    --lx-panel-w: 400px;
    --lx-panel-h: 600px;
  }
}

/* ---------- very small / short viewports -------------------------------- */
@media (max-height: 480px) {
  .lx-chat-log { padding: var(--lx-s-2) var(--lx-s-3); }
}

/* ---------- print: never print the widget ------------------------------- */
@media print {
  .lx-chat-root { display: none !important; }
}
