.tkchat-root {
  --tk-primary: #0f2a5c;
  --tk-primary-2: #1b47a0;
  --tk-bot: #f1f3f7;
  --tk-text: #14203a;
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 悬浮按钮 */
.tkchat-launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: var(--tk-primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 42, 92, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, background .15s ease;
}
.tkchat-launcher:hover { background: var(--tk-primary-2); transform: translateY(-2px); }
.tkchat-launcher--hidden { display: none; }

/* 面板 */
.tkchat-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 360px;
  height: 540px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(10, 25, 55, .28);
  flex-direction: column;
  color: var(--tk-text);
}
.tkchat-root.tkchat-open .tkchat-panel { display: flex; }

/* 头部 */
.tkchat-header {
  background: var(--tk-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tkchat-header-left { display: flex; flex-direction: column; }
.tkchat-header-title { font-weight: 600; font-size: 15px; }
.tkchat-header-sub { font-size: 12px; opacity: .8; display: flex; align-items: center; gap: 6px; }
.tkchat-header-sub::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: #3ddc84; display: inline-block;
}
.tkchat-close {
  background: transparent; border: 0; color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; opacity: .85;
}
.tkchat-close:hover { opacity: 1; }

/* 消息区 */
.tkchat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #fafbfd;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tkchat-msg { display: flex; }
.tkchat-msg--bot { justify-content: flex-start; }
.tkchat-msg--user { justify-content: flex-end; }
.tkchat-bubble {
  max-width: 80%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.tkchat-msg--bot .tkchat-bubble {
  background: var(--tk-bot);
  color: var(--tk-text);
  border-bottom-left-radius: 4px;
}
.tkchat-msg--user .tkchat-bubble {
  background: var(--tk-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* 输入区 */
.tkchat-inputrow {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e8ebf1;
  background: #fff;
}
.tkchat-input {
  flex: 1;
  border: 1px solid #dfe3eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.tkchat-input:focus { border-color: var(--tk-primary-2); }
.tkchat-send {
  width: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--tk-primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tkchat-send:hover { background: var(--tk-primary-2); }

/* 传图按钮 */
.tkchat-attach {
  width: 42px; flex: 0 0 auto;
  border: 1px solid #dfe3eb; border-radius: 10px;
  background: #fff; color: #5b6b86; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .15s;
}
.tkchat-attach:hover { border-color: var(--tk-primary-2); color: var(--tk-primary); background: #f2f6ff; }

/* 图片气泡 */
.tkchat-bubble--img { padding: 4px; background: transparent !important; }
.tkchat-bubble--img img { display: block; max-width: 180px; max-height: 180px; border-radius: 10px; }

/* 输入中动画 */
.tkchat-dots { display: inline-flex; gap: 3px; }
.tkchat-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9aa3b5; display: inline-block;
  animation: tkchat-blink 1.2s infinite both;
}
.tkchat-dots i:nth-child(2) { animation-delay: .2s; }
.tkchat-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes tkchat-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* 手机端 */
@media (max-width: 480px) {
  .tkchat-root { right: 12px; bottom: 96px; }
  .tkchat-panel {
    position: fixed;
    right: 0; bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}
