/* Touye AI Chat — 悬浮客服窗 */
.tac-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: #0a0f1c;
  box-shadow: 0 8px 24px rgba(10, 15, 28, .28);
  cursor: pointer;
  z-index: 9998;
  transition: transform .2s ease, opacity .2s ease;
}
.tac-launcher:hover { transform: translateY(-2px); }
.tac-launcher.tac-hidden { opacity: 0; transform: scale(.8); pointer-events: none; }
.tac-launcher-icon {
  position: absolute;
  left: 50%; top: 50%;
  width: 24px; height: 24px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 12px 12px 12px 3px;
}
.tac-launcher-icon::after {
  content: '';
  position: absolute;
  left: 5px; top: 9px;
  width: 10px; height: 2px;
  background: #fff;
  box-shadow: 0 4px 0 #fff;
}

.tac-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(10, 15, 28, .24);
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: #1a1f2c;
}
.tac-panel.tac-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.tac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0a0f1c;
  color: #fff;
}
.tac-header-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tac-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.tac-close {
  background: none; border: none; color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}

.tac-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tac-hint { padding: 12px 16px 0; color: #8a90a0; font-size: 12px; }
.tac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tac-msg { display: flex; }
.tac-msg-user { justify-content: flex-end; }
.tac-msg-model { justify-content: flex-start; }
.tac-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.tac-msg-user .tac-bubble { background: #0a0f1c; color: #fff; border-bottom-right-radius: 4px; }
.tac-msg-model .tac-bubble { background: #f1f3f7; color: #1a1f2c; border-bottom-left-radius: 4px; }
.tac-bubble a { color: #2563eb; text-decoration: underline; }
.tac-typing { color: #8a90a0; font-style: italic; }

.tac-lead {
  position: relative;
  margin: 0 16px 12px;
  padding: 14px;
  background: #fffaf0;
  border: 1px solid #f5d9a8;
  border-radius: 12px;
}
.tac-lead-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #9a7b3f;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.tac-lead-close:hover { color: #7a5200; }
.tac-lead-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: #7a5200; padding-right: 26px; }
.tac-lead-form { display: flex; flex-direction: column; gap: 8px; }
.tac-lead-form input {
  padding: 9px 11px;
  border: 1px solid #e0e3ea;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.tac-lead-form button {
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #0a0f1c;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.tac-hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.tac-lead-ok { color: #0f6e56; font-weight: 600; font-size: 13px; }

.tac-compose {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eceef3;
}
.tac-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e0e3ea;
  border-radius: 20px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.tac-input:focus { border-color: #0a0f1c; }
.tac-send {
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: #0a0f1c;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.tac-send:disabled, .tac-input:disabled { opacity: .5; cursor: not-allowed; }

/* 快捷问题 */
.tac-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.tac-quick-btn {
  padding: 6px 11px;
  border: 1px solid #d9dde6;
  border-radius: 16px;
  background: #f7f8fa;
  color: #2b3245;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.tac-quick-btn:hover { background: #eef1f6; border-color: #b9c0cf; }

/* Markdown 正文 */
.tac-bubble h4, .tac-bubble h5 { margin: 4px 0 2px; font-size: 14px; font-weight: 600; }
.tac-bubble ul { margin: 4px 0; padding-left: 18px; }
.tac-bubble li { margin: 2px 0; }
.tac-bubble code {
  background: rgba(120,130,150,.16);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .92em;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.tac-bubble strong { font-weight: 600; }
.tac-bubble a { color: #185fa5; text-decoration: none; }
.tac-bubble a:hover { text-decoration: underline; }
.tac-msg-user .tac-bubble a { color: #9fd0ff; }
.tac-gap { height: 6px; }

/* 打字机光标 */
.tac-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  vertical-align: -2px;
  margin-left: 2px;
  background: currentColor;
  animation: tacBlink .8s steps(1) infinite;
}
@keyframes tacBlink { 50% { opacity: 0; } }

@media (max-width: 480px) {
  .tac-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100vh - 100px); max-height: none; }
  .tac-launcher { right: 16px; bottom: 16px; }
}
