.threeqtour-chat {
  --tq-green: #169b62;
  --tq-green-dark: #0f7048;
  --tq-ink: #16231c;
  position: fixed;
  bottom: 22px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

.threeqtour-chat--left { left: 20px; }
.threeqtour-chat--right { right: 20px; }

.threeqtour-chat__launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--tq-green);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  cursor: pointer;
}

.threeqtour-chat__launcher:hover,
.threeqtour-chat__launcher:focus-visible { background: var(--tq-green-dark); }

.threeqtour-chat__panel {
  position: absolute;
  bottom: 64px;
  width: min(370px, calc(100vw - 28px));
  height: min(580px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .25);
}

.threeqtour-chat--left .threeqtour-chat__panel { left: 0; }
.threeqtour-chat--right .threeqtour-chat__panel { right: 0; }

.threeqtour-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--tq-green-dark), var(--tq-green));
  color: #fff;
}

.threeqtour-chat__header strong,
.threeqtour-chat__header small { display: block; }
.threeqtour-chat__header strong { font-size: 16px; }
.threeqtour-chat__header small { margin-top: 2px; opacity: .82; }

.threeqtour-chat__close {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  box-sizing: border-box;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0 !important;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  appearance: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.threeqtour-chat__close::before,
.threeqtour-chat__close::after { content: none !important; }
.threeqtour-chat__close:hover,
.threeqtour-chat__close:focus-visible { background: rgba(255, 255, 255, .14); }

/* 首頁另有 Astra 原生回頂端按鈕；停用重複的自訂按鈕，避免兩顆重疊。 */
body #backtop.backtop { display: none !important; }

.threeqtour-chat__messages {
  height: calc(100% - 196px);
  min-height: 250px;
  padding: 16px;
  overflow-y: auto;
  background: #f5f7f6;
}

.threeqtour-chat__message {
  width: fit-content;
  max-width: 86%;
  margin: 0 0 12px;
  padding: 10px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.55;
}

.threeqtour-chat__message--assistant {
  margin-right: auto;
  border-bottom-left-radius: 4px;
  background: #fff;
  color: var(--tq-ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.threeqtour-chat__message--user {
  margin-left: auto;
  border-bottom-right-radius: 4px;
  background: var(--tq-green);
  color: #fff;
}

.threeqtour-chat__actions {
  padding: 7px 14px 0;
  background: #fff;
  font-size: 13px;
}
.threeqtour-chat__actions a { color: var(--tq-green-dark); font-weight: 700; }

.threeqtour-chat__actions--urgent {
  padding: 10px 12px;
  background: #fff7e6;
  border-top: 1px solid #f3d39a;
  border-bottom: 1px solid #f3d39a;
}

.threeqtour-chat__actions--urgent a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tq-green);
  color: #fff;
  text-align: center;
  text-decoration: none;
}

.threeqtour-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px 6px;
  background: #fff;
}

.threeqtour-chat__form textarea {
  flex: 1;
  min-height: 42px;
  max-height: 92px;
  resize: none;
  border: 1px solid #ccd5d0;
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--tq-ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.threeqtour-chat__form button {
  min-width: 62px;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  background: var(--tq-green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.threeqtour-chat__form button:disabled { cursor: wait; opacity: .65; }

.threeqtour-chat__notice {
  margin: 0;
  padding: 0 12px 9px;
  background: #fff;
  color: #68736d;
  font-size: 11px;
  line-height: 1.35;
}

.threeqtour-chat__qr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.threeqtour-chat__qr-modal[hidden] { display: none; }

.threeqtour-chat__qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 14, .7);
  backdrop-filter: blur(3px);
}

.threeqtour-chat__qr-card {
  position: relative;
  z-index: 1;
  width: min(360px, calc(100vw - 32px));
  padding: 26px 24px 22px;
  border-radius: 18px;
  background: #fff;
  color: var(--tq-ink);
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

.threeqtour-chat__qr-card strong {
  display: block;
  padding: 0 24px;
  font-size: 19px;
}

.threeqtour-chat__qr-card p {
  margin: 9px 0 14px;
  color: #536159;
  font-size: 14px;
  line-height: 1.55;
}

.threeqtour-chat__qr-card img {
  display: block;
  width: min(260px, 100%);
  height: auto;
  margin: 0 auto 10px;
  border: 1px solid #e3e8e5;
  border-radius: 12px;
}

.threeqtour-chat__qr-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #526058;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.threeqtour-chat__qr-close:hover,
.threeqtour-chat__qr-close:focus-visible { background: #edf4f0; }

.threeqtour-chat__qr-id {
  display: block;
  color: var(--tq-green-dark);
  font-weight: 800;
}

.threeqtour-chat__qr-web-link {
  display: inline-block;
  margin-top: 12px;
  color: #66736c;
  font-size: 12px;
}

@media (max-width: 480px) {
  .threeqtour-chat { bottom: 14px; }
  .threeqtour-chat--left { left: 14px; }
  .threeqtour-chat--right { right: 14px; }
  .threeqtour-chat__panel {
    position: fixed;
    inset: 12px;
    width: auto;
    height: auto;
    border-radius: 16px;
  }
  .threeqtour-chat__messages { height: calc(100% - 196px); }
}

@media (prefers-reduced-motion: no-preference) {
  .threeqtour-chat__panel { animation: threeqtour-chat-in .18s ease-out; }
  @keyframes threeqtour-chat-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: none; }
  }
}
