/**
 * 龍記水電潔具工程 — 觸控端漂浮排版（UI only · ≤1024px）
 * Copyright © 2024–2026 龍記水電潔具工程。版權所有。
 */
/* lj-chat-css-split-v1 | lungkee-ai-chat-float-mobile.css — 觸控 ≤1024px */
@media (max-width: 1024px) {
  #longji-ai-float-layer.is-open .lungkee-ai-chat__float-panel,
  .lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-panel {
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
  }

  #longji-ai-float-layer.is-open .lungkee-ai-chat__header-actions,
  .lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__header-actions {
    position: relative;
    z-index: 20;
    pointer-events: auto !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;
    opacity: 0 !important;
  }

  #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 {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .lungkee-ai-chat__header {
    padding: 12px 14px;
  }

  .lungkee-ai-chat__header .lungkee-ai-chat__title {
    font-size: 16px;
  }

  .lungkee-ai-chat__messages {
    min-height: 280px;
    height: 360px;
    height: clamp(300px, 52dvh, 400px);
    padding: 12px;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lungkee-ai-chat__bubble {
    max-width: 92%;
  }

  .lungkee-ai-chat__footer {
    padding: 10px 12px max(14px, calc(10px + env(safe-area-inset-bottom, 0px)));
  }

  .lungkee-ai-chat__footer-legal {
    margin-top: 10px;
    padding-top: 10px;
    gap: 8px;
  }

  .lungkee-ai-chat__copyright-row {
    font-size: 9.5px;
  }

  .lungkee-ai-chat__hint {
    padding: 8px 10px;
  }

  .lungkee-ai-chat__hint-p {
    font-size: 10px;
    line-height: 1.5;
  }

  .lungkee-ai-chat__quick-toolbar {
    margin-bottom: 8px;
  }

  .lungkee-ai-chat__quick-label {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .lungkee-ai-chat__quick-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .lungkee-ai-chat__quick-row .lungkee-ai-chat__quick {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .lungkee-ai-chat__quick {
    gap: 8px;
  }

  .lungkee-ai-chat__quick-btn {
    font-size: 13px;
    padding: 10px 14px;
    min-height: 44px;
    line-height: 1.25;
    -webkit-tap-highlight-color: transparent;
  }

  .lungkee-ai-chat__wa-link {
    margin-left: 0;
    width: 100%;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 13px;
    box-sizing: border-box;
  }

  .lungkee-ai-chat__input-stack {
    gap: 8px;
    margin-bottom: 8px;
  }

  .lungkee-ai-chat__service-frame {
    gap: 6px;
    padding: 5px;
    border-radius: 14px;
  }

  .lungkee-ai-chat__service-btn {
    min-height: 48px;
    padding: 8px 4px;
  }

  .lungkee-ai-chat__service-btn-label {
    font-size: 13px;
  }

  .lungkee-ai-chat__service-btn-sub {
    font-size: 10px;
  }

  .lungkee-ai-chat__appt-actions {
    gap: 6px;
  }

  .lungkee-ai-chat__composer {
    padding: 3px 3px 3px 12px;
    gap: 6px;
  }

  .lungkee-ai-chat__input {
    padding: 6px 2px 6px 0;
    min-height: 38px;
    max-height: 96px;
    font-size: 16px;
    line-height: 1.35;
  }

  .lungkee-ai-chat__send {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .lungkee-ai-chat--theme-modern .lungkee-ai-chat__composer {
    padding: 5px 8px;
    margin: 0 8px 8px;
    gap: 6px;
  }

  /* 漂浮全屏：composer 勿再加左右 margin，避免輸入框過界 */
  .lungkee-ai-chat-float-layer .lungkee-ai-chat--theme-modern .lungkee-ai-chat__composer,
  #longji-ai-float-layer .lungkee-ai-chat--theme-modern .lungkee-ai-chat__composer,
  .lungkee-ai-chat-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__composer,
  #longji-ai-float-layer .lungkee-ai-chat--maint-suite .lungkee-ai-chat__composer {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    align-items: center !important;
  }

  .lungkee-ai-chat-float-layer .lungkee-ai-chat__footer,
  #longji-ai-float-layer .lungkee-ai-chat__footer {
    padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
  }

  .lungkee-ai-chat-float-layer .lungkee-ai-chat__input-stack,
  #longji-ai-float-layer .lungkee-ai-chat__input-stack,
  .lungkee-ai-chat-float-layer .lungkee-ai-chat__service-dock,
  #longji-ai-float-layer .lungkee-ai-chat__service-dock,
  .lungkee-ai-chat-float-layer .lungkee-ai-chat__service-frame,
  #longji-ai-float-layer .lungkee-ai-chat__service-frame,
  .lungkee-ai-chat-float-layer .lungkee-ai-chat__mgmt-exit-row,
  #longji-ai-float-layer .lungkee-ai-chat__mgmt-exit-row,
  .lungkee-ai-chat-float-layer .lungkee-ai-chat__wizard-progress-row,
  #longji-ai-float-layer .lungkee-ai-chat__wizard-progress-row {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  .lungkee-ai-chat-float-layer .lungkee-ai-chat__input,
  #longji-ai-float-layer .lungkee-ai-chat__input {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
  }

  /* 對話背景：關閉粒子／火花（header LOGO 球不受影響） */
  .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 {
    display: none !important;
    visibility: hidden !important;
  }

  .lungkee-ai-chat--theme-modern .lungkee-ai-chat__input {
    padding: 6px 2px !important;
    min-height: 36px;
    font-size: 16px !important;
  }

  .lungkee-ai-chat__send::before {
    width: 34px;
    height: 34px;
  }

  .lungkee-ai-chat__hint {
    font-size: 10px;
    margin-left: 0;
    margin-right: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* 觸控端懸浮：全屏對話（手機／平板 ≤1024px，覆蓋 chat.css 底欄抽屜 max-height） */
  .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 {
    --lj-float-panel-h: calc(
      100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
    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: var(--lj-float-panel-h) !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 0 !important;
    z-index: 10;
    transform: translateZ(0);
    box-shadow: none !important;
  }

  .lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__float-backdrop,
  #longji-ai-float-layer.is-open .lungkee-ai-chat__float-backdrop {
    z-index: 1;
    background: rgba(15, 23, 42, 0.55);
  }

  .lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__messages {
    flex: 1 1 auto;
    min-height: 140px;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto;
  }

  .lungkee-ai-chat__bubble--stream::after {
    animation: lj-cursor-blink 0.75s step-end infinite;
  }

  .lungkee-ai-chat__quick-toolbar {
    display: none !important;
  }

  /* 手機漂浮外衣：輸入區與傳送鈕同高（勿再用 52px 蓋過模板設定） */
  .lungkee-ai-chat-float-host[data-lj-shell='mobile-float'] #longji-ai-float-layer .lungkee-ai-chat__send,
  .lungkee-ai-chat-float-host[data-lj-shell='global-float'] #longji-ai-float-layer .lungkee-ai-chat__send,
  #longji-ai-float-layer .lungkee-ai-chat__send {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }

  #longji-ai-float-layer .lungkee-ai-chat__send::before {
    width: 28px !important;
    height: 28px !important;
  }

  .lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher,
  .lungkee-ai-chat__float-launcher {
    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)));
    z-index: 2147482000;
    gap: 0;
    min-height: 64px;
    min-width: 64px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher:hover {
    transform: none;
    box-shadow: none;
  }

  .lungkee-ai-chat-float-host .lungkee-ai-chat__float-launcher-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .lungkee-ai-chat-float-host .longji-ai-orb--launcher {
    --lj-orb-px: 64px;
    --lj-orb-label: 18px;
    --lj-orb-glow-border: 3.5px;
  }

  /* 手機懸浮：外圈 64px，中間地球略大（粒子留邊）；公司字帶見 orb-brand.css */
  .lungkee-ai-chat-float-host .longji-ai-orb--launcher .longji-ai-orb__core {
    width: 66%;
    height: 66%;
  }

}

/* 僅手機窄屏（≤767px）：精簡頁腳 */
@media (max-width: 767px) {
  .lungkee-ai-chat-float-layer.is-open .lungkee-ai-chat__messages {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
  }

  .lungkee-ai-chat--phone-layout .lungkee-ai-chat__footer {
    padding: 6px 10px max(8px, calc(6px + env(safe-area-inset-bottom, 0px)));
  }

  .lungkee-ai-chat__footer-legal--mobile {
    margin-top: 6px;
    padding-top: 6px;
    gap: 4px;
  }

  .lungkee-ai-chat--phone-layout .lungkee-ai-chat__footer-line {
    font-size: 9px;
    line-height: 1.35;
  }

  .lungkee-ai-chat--phone-layout .lungkee-ai-chat__footer-line--brand {
    font-size: 9.5px;
  }
}
