/**
 * 龍記水電潔具工程 — 漂浮層結構與開窗動畫（UI only）
 * Copyright © 2024–2026 龍記水電潔具工程。版權所有。
 */
/* lj-chat-css-split-v1 | lungkee-ai-chat-float-core.css — 漂浮層結構 + 隔離 */
/*
 * 漂浮層掛在 body，不在 .met-editor 內 — 須複製內嵌保護，否則米拓全站
 * button { width:… } / writing-mode 會令屋苑掣、氣泡字變「一字一行」直排
 */
#longji-ai-float-layer .lungkee-ai-chat,
#longji-ai-float-layer .lungkee-ai-chat.lungkee-ai-chat__float-inner {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box;
}

#longji-ai-float-layer .lungkee-ai-chat__header .lungkee-ai-chat__title,
#longji-ai-float-layer .lungkee-ai-chat__header .lungkee-ai-chat__subtitle {
  color: #ffffff !important;
  opacity: 1 !important;
}

#longji-ai-float-layer button.lungkee-ai-chat__quick-btn,
#longji-ai-float-layer button.lungkee-ai-chat__service-btn,
#longji-ai-float-layer button.lungkee-ai-chat__appt-btn,
#longji-ai-float-layer button.lungkee-ai-chat__mgmt-exit-btn,
#longji-ai-float-layer button.lungkee-ai-chat__inspire-chip {
  box-sizing: border-box;
  height: auto;
  line-height: inherit;
  min-height: 0;
  max-height: none;
  pointer-events: auto !important;
  touch-action: manipulation;
  width: 100%;
  min-width: 0;
}

/* 米拓全站 button 漸層會叠假玻璃 — 只清 background-image，款式色由 modern.css + component_style_uid 控制 */
#longji-ai-float-layer .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn,
.lungkee-ai-chat-float-layer .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn,
.met-editor .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn,
.editor-content .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn,
#ueditor_0 .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
}

#longji-ai-float-layer .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn--agree,
#longji-ai-float-layer .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn--edit,
.lungkee-ai-chat-float-layer .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn--agree,
.lungkee-ai-chat-float-layer .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn--edit,
.met-editor .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn--agree,
.met-editor .lungkee-ai-chat--maint-suite button.lungkee-ai-chat__appt-btn--edit {
  background-image: none !important;
}

#longji-ai-float-layer .lungkee-ai-chat__inspire-chips {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#longji-ai-float-layer
  .lungkee-ai-chat:not(.lungkee-ai-chat--inspire-hidden)
  .lungkee-ai-chat__inspire:not([hidden]) {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#longji-ai-float-layer .lungkee-ai-chat__inspire-chip {
  width: 100% !important;
  min-height: 42px !important;
}

#longji-ai-float-layer .lungkee-ai-chat__inspire-chip:last-child:nth-child(odd) {
  grid-column: 1 / -1 !important;
}

/* 發送掣保持固定尺寸，勿用 height:auto（會壓細手機端 52px） */
#longji-ai-float-layer button.lungkee-ai-chat__send {
  box-sizing: border-box;
  flex-shrink: 0;
}

#longji-ai-float-layer button.lungkee-ai-chat__service-btn {
  min-height: 52px;
  max-height: 58px;
  padding: 8px 6px;
}

/* 未開窗：絕不顯示關閉鈕（避免預載殼時首屏露出 ×） */
.lungkee-ai-chat-float-layer:not(.is-open) .lungkee-ai-chat__float-close,
.lungkee-ai-chat-float-layer:not(.is-open) button.lungkee-ai-chat__float-close {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 漂浮窗：隱藏「重新開始」↺（關閉再開即可） */
#longji-ai-float-layer .lungkee-ai-chat__header-actions [data-ref="btn-clear-chat"],
.lungkee-ai-chat-float-layer .lungkee-ai-chat__header-actions [data-ref="btn-clear-chat"] {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* 開窗後：標題列 × 關閉（米拓全站 button 規則會壓沒尺寸／層級） */
#longji-ai-float-layer.is-open .lungkee-ai-chat__header-actions button.lungkee-ai-chat__float-close,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions button.lungkee-ai-chat__float-close {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: static !important;
  z-index: auto !important;
  top: auto !important;
  right: auto !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  border: none !important;
  border-radius: 50% !important;
  background: linear-gradient(145deg, #5c2323 0%, #6d2828 48%, #7c2d2d 100%) !important;
  color: #fff !important;
  font-size: 18px !important;
  cursor: pointer !important;
  box-shadow: 0 3px 12px rgba(45, 18, 18, 0.42) !important;
  transform: none !important;
}

#longji-ai-float-layer.is-open .lungkee-ai-chat__header-actions button.lungkee-ai-chat__float-close:hover,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions button.lungkee-ai-chat__float-close:hover {
  background: linear-gradient(145deg, #4a1c1c 0%, #5c2323 48%, #6d2828 100%) !important;
  transform: none !important;
}

#longji-ai-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close-icon,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  color: #fff !important;
}

#longji-ai-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close-svg,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close-svg {
  display: block !important;
  width: 26px !important;
  height: 26px !important;
}

/* 維護配套皮（--maint-suite）：關閉鈕固定右上角，避免與標題擠位／裁切 */
#longji-ai-float-layer.is-open .lungkee-ai-chat--maint-suite .lungkee-ai-chat__header,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat--maint-suite .lungkee-ai-chat__header {
  position: relative !important;
  overflow: visible !important;
  padding-top: max(14px, env(safe-area-inset-top, 0px)) !important;
  padding-right: 56px !important;
  padding-left: 14px !important;
  padding-bottom: 14px !important;
}

#longji-ai-float-layer.is-open .lungkee-ai-chat--maint-suite .lungkee-ai-chat__header-actions,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat--maint-suite .lungkee-ai-chat__header-actions {
  position: absolute !important;
  top: max(10px, env(safe-area-inset-top, 0px)) !important;
  right: max(10px, env(safe-area-inset-right, 0px)) !important;
  left: auto !important;
  margin: 0 !important;
  z-index: 20 !important;
}

#longji-ai-float-layer.is-open
  .lungkee-ai-chat--maint-suite
  .lungkee-ai-chat__header-actions
  button.lungkee-ai-chat__float-close,
.lungkee-ai-chat-float-layer.is-open
  .lungkee-ai-chat--maint-suite
  .lungkee-ai-chat__header-actions
  button.lungkee-ai-chat__float-close {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
}

/* —— 懸浮客服（第三方全站嵌入：data-display="float"）—— */
/* 對話層掛在 body（#longji-ai-float-layer），宿主只放右下角圖標 */
.lungkee-ai-chat-float-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  pointer-events: none;
}

.lungkee-ai-chat-float-layer:not(.is-open) .lungkee-ai-chat__float-panel,
.lungkee-ai-chat-float-layer:not(.is-open) .lungkee-ai-chat__float-backdrop,
#longji-ai-float-layer:not(.is-open) .lungkee-ai-chat__float-panel,
.lungkee-ai-chat__float-panel[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.lungkee-ai-chat-float-host[data-lj-float-launcher-live='1']:not(.is-open) .lungkee-ai-chat__float-launcher,
.lungkee-ai-chat-float-host[data-lj-float-launcher-live='1']:not(.is-open) .lj-chat-loader-launcher {
  pointer-events: auto !important;
}

/* 手機落地：頁面滾動／上滑時球不可點，避免關窗後蹭到球又彈窗 */
body.lungkee-ai-chat-scroll-active
  .lungkee-ai-chat-float-host[data-lj-shell='mobile-float']:not(.is-open)
  .lungkee-ai-chat__float-launcher,
body.lungkee-ai-chat-scroll-active
  .lungkee-ai-chat-float-host[data-lj-shell='mobile-float']:not(.is-open)
  .lj-chat-loader-launcher {
  pointer-events: none !important;
}

#longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel,
#longji-ai-float-layer.is-open .lungkee-ai-chat__float-backdrop,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-panel,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-backdrop {
  pointer-events: auto !important;
}

#longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel button,
#longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel textarea,
#longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel a,
#longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel input,
#longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel [role='log'],
#longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel .lungkee-ai-chat__messages,
#longji-ai-float-layer.is-open
  .lungkee-ai-chat__float-panel
  .lungkee-ai-chat__header-actions
  button.lungkee-ai-chat__float-close {
  pointer-events: auto !important;
  touch-action: manipulation;
}

.lungkee-ai-chat-float-host,
#lungkee-ai-chat-root[data-display='float'].lungkee-ai-chat-float-host,
#lungkee-ai-chat-float-root[data-display='float'].lungkee-ai-chat-float-host,
#lungkee-ai-chat-float-root-desktop[data-display='float'].lungkee-ai-chat-float-host,
#lungkee-ai-chat-float-root-mobile[data-display='float'].lungkee-ai-chat-float-host {
  position: fixed;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  z-index: 2147483001;
  pointer-events: none;
}

/* 殼未就緒：只藏內嵌對話，不藏 loader 球（球在 data-lj-loader-shell 宿主內） */
[data-display='float']:not(.lungkee-ai-chat-float-host) .lungkee-ai-chat {
  display: none !important;
  visibility: hidden !important;
}

[data-display='float'][data-lj-loader-shell='1']:not(.lungkee-ai-chat-float-host) {
  position: fixed;
  width: auto;
  height: auto;
  overflow: visible;
  visibility: visible;
  z-index: 2147483001;
  pointer-events: none;
  margin: 0;
  padding: 0;
  border: 0;
}

[data-display='float'][data-lj-loader-shell='1']:not(.is-open) .lj-chat-loader-launcher {
  pointer-events: auto;
  visibility: visible;
}

.lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher {
  pointer-events: auto;
}

.lungkee-ai-chat__float-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(15, 23, 42, 0.52);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-backdrop {
  z-index: 1;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-panel {
  position: fixed;
  z-index: 10;
  isolation: isolate;
  transform: translateZ(0);
}

.lungkee-ai-chat-float-host {
  --lj-float-offset-x: 14px;
  --lj-float-offset-y: 14px;
}

.lungkee-ai-chat-float-host--plugin-off .lungkee-ai-chat__float-launcher,
.lungkee-ai-chat-float-host--plugin-off.lungkee-ai-chat-float-host {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 漂浮入口 = 純 LOGO 球（與 loader 假球、隔離測試頁同款；勿加藍色 pill） */
.lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher,
.lungkee-ai-chat__float-launcher {
  position: fixed;
  z-index: 2147482000;
  top: auto;
  left: auto;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(62px, calc(14px + 48px + env(safe-area-inset-bottom, 0px)));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher:hover,
.lungkee-ai-chat__float-launcher:hover {
  transform: none;
  box-shadow: none;
}

.lungkee-ai-chat__float-launcher-orb {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  pointer-events: none;
  overflow: visible;
  padding: 0;
  border-radius: 50%;
  box-sizing: border-box;
  width: 64px;
  height: 64px;
}

@media (min-width: 1025px) {
  .lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher-orb {
    width: 80px;
    height: 80px;
  }
}

.lungkee-ai-chat__float-launcher-orb .lungkee-ai-chat__float-launcher-hero-wrap,
.lungkee-ai-chat__float-launcher-orb .lungkee-ai-chat__float-launcher-hero,
.lungkee-ai-chat__float-launcher-orb .longji-ai-orb,
.lungkee-ai-chat__float-launcher-orb .longji-ai-orb * {
  pointer-events: none;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-panel {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-backdrop {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* 未開窗：絕不露出對話 panel／遮罩（防 resize 重排時 base flex 把歡迎卡畫出） */
.lungkee-ai-chat-float-layer:not(.is-open) .lungkee-ai-chat__float-panel,
.lungkee-ai-chat-float-layer:not(.is-open) .lungkee-ai-chat__float-panel,
#longji-ai-float-layer:not(.is-open) .lungkee-ai-chat__float-panel,
.lungkee-ai-chat-float-layer:not(.is-open) .lungkee-ai-chat__float-backdrop,
.lungkee-ai-chat-float-layer:not(.is-open) .lungkee-ai-chat__float-backdrop,
#longji-ai-float-layer:not(.is-open) .lungkee-ai-chat__float-backdrop {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__float-panel,
.lungkee-ai-chat__float-panel {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  max-width: 100vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--lj-surface);
  transform: translateZ(0);
}

@media (max-width: 1024px) {
  .lungkee-ai-chat-float-layer .lungkee-ai-chat__float-panel,
  .lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-panel,
  #longji-ai-float-layer .lungkee-ai-chat__float-panel,
  #longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel {
    top: env(safe-area-inset-top, 0px) !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: calc(
      100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    ) !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

@media (min-width: 1025px) {
  .lungkee-ai-chat-float-layer .lungkee-ai-chat__float-panel,
  .lungkee-ai-chat__float-panel {
    max-height: min(92dvh, 720px);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 48px rgba(15, 23, 42, 0.28);
  }
}

.lungkee-ai-chat__float-close {
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  touch-action: manipulation;
  pointer-events: auto;
  display: none;
  visibility: hidden;
  position: relative;
  z-index: 5;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  visibility: visible;
  pointer-events: auto;
  width: 40px;
  height: 40px;
  background: linear-gradient(145deg, #5c2323 0%, #6d2828 48%, #7c2d2d 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(45, 18, 18, 0.42);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close--pill {
  width: auto;
  min-width: 52px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
}

.lungkee-ai-chat__float-close-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
}

/* 關窗後密封（與 lungkee-ai-chat.js ensureFloatCriticalCss 一致；供診斷合併 CSS 掃描） */
#longji-ai-float-layer.lungkee-ai-chat-float-layer--sealed .lungkee-ai-chat__float-panel,
#longji-ai-float-layer.lungkee-ai-chat-float-layer--sealed .lungkee-ai-chat__float-backdrop,
.lungkee-ai-chat-float-layer.lungkee-ai-chat-float-layer--sealed .lungkee-ai-chat__float-panel,
.lungkee-ai-chat-float-layer.lungkee-ai-chat-float-layer--sealed .lungkee-ai-chat__float-backdrop,
.lungkee-ai-chat-float-layer.lungkee-ai-chat-float-layer--sealed .lungkee-ai-chat__welcome-pin,
#longji-ai-float-layer.lungkee-ai-chat-float-layer--sealed .lungkee-ai-chat__welcome-pin {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translate3d(0, 120%, 0) !important;
  max-height: 0 !important;
  overflow: hidden !important;
  transition: none !important;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close:hover {
  background: linear-gradient(145deg, #4a1c1c 0%, #5c2323 48%, #6d2828 100%);
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions .lungkee-ai-chat__float-close-svg {
  width: 26px;
  height: 26px;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__float-inner {
  position: relative;
  z-index: 1;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__header {
  padding-right: 18px;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin-right: 0;
  margin-top: 2px;
}

.lungkee-ai-chat__float-inner {
  flex: 1;
  min-height: 0;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat,
.lungkee-ai-chat-float-host .lungkee-ai-chat {
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__msg-avatar,
.lungkee-ai-chat-float-layer .longji-ai-orb--msg {
  flex-shrink: 0;
  overflow: visible;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-inner,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__header,
.lungkee-ai-chat-float-host .lungkee-ai-chat__header {
 border-radius: 0;
 flex-shrink: 0;
}

.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__messages {
  flex: 1 1 auto;
  min-height: 160px;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 對話核心：全端關閉背景 canvas 粒子／火花（舊 DOM 快取亦強制隱藏） */
.lungkee-ai-chat-float-layer .lungkee-ai-chat__suite-particles-canvas,
#longji-ai-float-layer .lungkee-ai-chat__suite-particles-canvas,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__suite-sparks,
#longji-ai-float-layer .lungkee-ai-chat__suite-sparks,
.lungkee-ai-chat--maint-suite .lungkee-ai-chat__suite-particles-canvas,
.lungkee-ai-chat--maint-suite .lungkee-ai-chat__suite-sparks {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__footer {
  flex-shrink: 0;
}

/*
 * 懸浮窗隔離：米拓全站常見 flex-direction:row / writing-mode 會把
 * 對話區壓成極窄直排（嵌入端因區塊較寬較不明顯）
 * 使用 #longji-ai-float-layer 提高優先級，壓過 body * 等全站規則
 */
#longji-ai-float-layer,
#longji-ai-float-layer *,
.lungkee-ai-chat-float-layer,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__float-panel,
.lungkee-ai-chat-float-layer .lungkee-ai-chat.lungkee-ai-chat__float-inner,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__float-inner,
.lungkee-ai-chat-float-layer .lungkee-ai-chat {
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  text-combine-upright: none !important;
  direction: ltr !important;
  unicode-bidi: normal !important;
}

#longji-ai-float-layer .lungkee-ai-chat__float-panel,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__float-panel {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

#longji-ai-float-layer .lungkee-ai-chat.lungkee-ai-chat__float-inner,
#longji-ai-float-layer .lungkee-ai-chat__float-inner,
#longji-ai-float-layer .lungkee-ai-chat,
.lungkee-ai-chat-float-layer .lungkee-ai-chat.lungkee-ai-chat__float-inner,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__float-inner,
.lungkee-ai-chat-float-layer .lungkee-ai-chat {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__header,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__messages,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__footer,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__input-stack,
.lungkee-ai-chat-float-layer .lungkee-ai-chat__composer {
  writing-mode: horizontal-tb !important;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__msg {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__msg--user {
  flex-direction: row !important;
  justify-content: flex-end;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__msg-body {
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(88%, 420px);
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__msg--bot .lungkee-ai-chat__msg-body {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: calc(100% - 52px);
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__msg--bot .lungkee-ai-chat__bubble {
  max-width: 100%;
  width: 100%;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__msg--user .lungkee-ai-chat__msg-body {
  flex: 0 1 auto;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__bubble {
  writing-mode: horizontal-tb !important;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__bubble--pics,
#longji-ai-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__bubble--pics {
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 12px !important;
  border: 1px solid rgba(125, 211, 252, 0.35) !important;
  background: #0a1020 !important;
  background-image: none !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38) !important;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__pics-statement,
#longji-ai-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__pics-statement {
  display: block;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
  background: #0a1020 !important;
  background-image: none !important;
  color: #e2e8f0 !important;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__pics-footer-hint,
#longji-ai-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__pics-footer-hint {
  margin: 0 !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
  text-align: center !important;
  background: #c62828 !important;
  background-image: none !important;
  color: #ffffff !important;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__bubble--pics {
  padding: 0 !important;
  overflow: hidden;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__pics-statement {
  display: block;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__pics-footer-hint {
  margin: 0 !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
  text-align: center !important;
  color: #fff !important;
  background: var(--lj-pics-footer-bg, var(--lj-operator-accent, #c62828)) !important;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__composer {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
}

.lungkee-ai-chat-float-layer .lungkee-ai-chat__input {
  writing-mode: horizontal-tb !important;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  display: block;
}

.lungkee-ai-chat-float-host.is-open .lungkee-ai-chat__float-launcher,
#longji-ai-float-layer.is-open .lungkee-ai-chat__float-launcher,
.lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher,
.lungkee-ai-chat-float-host.is-open .lj-chat-loader-launcher,
body.lungkee-ai-chat-float-open .lj-chat-loader-launcher {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.lungkee-ai-chat-float-open,
body.lungkee-ai-chat-float-open {
  overflow: hidden !important;
  height: 100%;
}

body.lungkee-ai-chat-float-open.lj-float-body-scroll-lock {
  overscroll-behavior: none;
  touch-action: none;
}

body.lungkee-ai-chat-float-open.lj-float-body-scroll-lock .lungkee-ai-chat__float-panel,
body.lungkee-ai-chat-float-open.lj-float-body-scroll-lock .lungkee-ai-chat__messages,
body.lungkee-ai-chat-float-open.lj-float-body-scroll-lock .lungkee-ai-chat__input-wrap {
  touch-action: manipulation;
}

/* 外衣首幀角位（避免 JS 掛類前閃到右下） */
@media (min-width: 1025px) {
  .lungkee-ai-chat-float-host[data-lj-shell='global-float'] .lungkee-ai-chat__float-launcher,
  .lungkee-ai-chat-float-host[data-lj-shell='desktop-float'] .lungkee-ai-chat__float-launcher,
  .lungkee-ai-chat-float-host[data-float-responsive='true'] .lungkee-ai-chat__float-launcher {
    top: max(var(--lj-float-offset-y, 16px), env(safe-area-inset-top, 0px));
    right: max(var(--lj-float-offset-x, 16px), env(safe-area-inset-right, 0px));
    bottom: auto;
    left: auto;
  }
}

.lungkee-ai-chat-float-host.lj-float-host--layout-pending .lungkee-ai-chat__float-launcher {
  visibility: hidden;
  pointer-events: none;
}

.lungkee-ai-chat__float-inner.lungkee-ai-chat--booting {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lungkee-ai-chat__float-inner.lungkee-ai-chat--booting::after {
  content: '載入中…';
  font-size: 14px;
  color: #64748b;
  letter-spacing: 0.05em;
}

/* 插件角位（全端懸浮球；預設右下） */
.lungkee-ai-chat-float-host--launcher-top-right .lungkee-ai-chat__float-launcher {
  top: max(var(--lj-float-offset-y, 16px), env(safe-area-inset-top, 0px));
  right: max(var(--lj-float-offset-x, 16px), env(safe-area-inset-right, 0px));
  bottom: auto;
  left: auto;
}

.lungkee-ai-chat-float-host--launcher-top-left .lungkee-ai-chat__float-launcher {
  top: max(var(--lj-float-offset-y, 16px), env(safe-area-inset-top, 0px));
  left: max(var(--lj-float-offset-x, 16px), env(safe-area-inset-left, 0px));
  bottom: auto;
  right: auto;
}

.lungkee-ai-chat-float-host--launcher-bottom-right .lungkee-ai-chat__float-launcher {
  bottom: max(62px, calc(14px + 48px + env(safe-area-inset-bottom, 0px)));
  right: max(12px, env(safe-area-inset-right, 0px));
  top: auto;
  left: auto;
}

.lungkee-ai-chat-float-host--launcher-bottom-left .lungkee-ai-chat__float-launcher {
  bottom: max(62px, calc(14px + 48px + env(safe-area-inset-bottom, 0px)));
  left: max(12px, env(safe-area-inset-left, 0px));
  top: auto;
  right: auto;
}

.lungkee-ai-chat-float-layer--panel-top-right.is-open .lungkee-ai-chat__float-panel {
  top: max(var(--lj-float-offset-y, 16px), env(safe-area-inset-top, 0px));
  right: max(var(--lj-float-offset-x, 16px), env(safe-area-inset-right, 0px));
  bottom: auto;
  left: auto;
}

.lungkee-ai-chat-float-layer--panel-top-left.is-open .lungkee-ai-chat__float-panel {
  top: max(var(--lj-float-offset-y, 16px), env(safe-area-inset-top, 0px));
  left: max(var(--lj-float-offset-x, 16px), env(safe-area-inset-left, 0px));
  bottom: auto;
  right: auto;
}

.lungkee-ai-chat-float-layer--panel-bottom-left.is-open .lungkee-ai-chat__float-panel {
  bottom: max(var(--lj-float-offset-y, 14px), env(safe-area-inset-bottom, 0px));
  left: max(var(--lj-float-offset-x, 14px), env(safe-area-inset-left, 0px));
  top: auto;
  right: auto;
}

.lungkee-ai-chat-float-layer--bottom-sheet.is-open .lungkee-ai-chat__float-panel {
  max-height: min(88dvh, 640px);
  border-radius: 16px 16px 0 0;
}

.lungkee-ai-chat-float-layer--phone-full.is-open .lungkee-ai-chat__float-panel {
  max-height: min(92dvh, 720px);
}

@keyframes lj-float-anim-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes lj-float-anim-slide-up-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lj-float-anim-slide-down-in {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lj-float-anim-slide-left-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes lj-float-anim-slide-right-in {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes lj-float-anim-scale-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lungkee-ai-chat-float-layer--anim-fade.is-open .lungkee-ai-chat__float-panel {
  animation: lj-float-anim-fade-in 0.28s ease-out;
}

.lungkee-ai-chat-float-layer--anim-slide-up.is-open .lungkee-ai-chat__float-panel {
  animation: lj-float-anim-slide-up-in 0.32s ease-out;
}

.lungkee-ai-chat-float-layer--anim-slide-down.is-open .lungkee-ai-chat__float-panel {
  animation: lj-float-anim-slide-down-in 0.32s ease-out;
}

.lungkee-ai-chat-float-layer--anim-slide-left.is-open .lungkee-ai-chat__float-panel {
  animation: lj-float-anim-slide-left-in 0.32s ease-out;
}

.lungkee-ai-chat-float-layer--anim-slide-right.is-open .lungkee-ai-chat__float-panel {
  animation: lj-float-anim-slide-right-in 0.32s ease-out;
}

.lungkee-ai-chat-float-layer--anim-scale.is-open .lungkee-ai-chat__float-panel {
  animation: lj-float-anim-scale-in 0.28s ease-out;
}
