.zk-chat {
  --zk-ink: #14344a;
  --zk-teal: #0e6d65;
  --zk-mint: #c3efdf;
  --zk-line: #d8e6e8;
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20;
  color: var(--zk-ink);
  font: 15px/1.55 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
.zk-chat *, .zk-chat *::before, .zk-chat *::after { box-sizing: border-box; }
.zk-chat [hidden] { display: none; }
.zk-chat button { font: inherit; cursor: pointer; }
.zk-chat button:disabled { cursor: default; opacity: .55; }
.zk-chat :is(button, a, input):focus-visible { outline: 2px solid #269391; outline-offset: 3px; }
.zk-chat-launch { display: flex; align-items: center; gap: 9px; padding: 8px 16px 8px 10px; min-height: 52px; border: 1px solid #95cfc1; border-radius: 999px; color: var(--zk-ink); background: #e5f7f0; box-shadow: 0 5px 20px #102b4233; }
.zk-chat-launch:hover { background: var(--zk-mint); }
.zk-chat-launch > span:last-child { font-weight: 800; }
.zk-chat-welcome {
  position: fixed;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  display: grid;
  justify-items: center;
  width: min(340px, calc(100vw - 32px));
  padding: 24px 20px;
  border: 1px solid #a8d1c8;
  border-radius: 20px;
  text-align: center;
  background: linear-gradient(155deg, #e4f7ef, #fff 76%);
  box-shadow: 0 16px 44px #102b4240;
  animation: zk-welcome-in .25s ease-out, zk-welcome-float 1.7s ease-in-out .25s 2;
}
.zk-chat-welcome-avatar { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 9px; border-radius: 50%; background: #d1eee4; }
.zk-chat-welcome p { display: grid; gap: 4px; margin: 0; }
.zk-chat-welcome p strong { font-size: 20px; }
.zk-chat-welcome p span { color: #466373; font-size: 14px; }
.zk-chat .zk-chat-welcome-open { margin-top: 14px; min-height: 40px; padding: 6px 15px; border: 1px solid var(--zk-teal); border-radius: 8px; color: #fff; background: var(--zk-teal); font-size: 14px; font-weight: 700; }
.zk-chat .zk-chat-welcome-open:hover { background: #105850; }
.zk-chat .zk-chat-welcome-close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 7px; color: var(--zk-ink); background: transparent; font-size: 22px; }
.zk-chat .zk-chat-welcome-close:hover { background: #e5f7f0; }
@keyframes zk-welcome-in { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes zk-welcome-float { 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .zk-chat-welcome { animation: none; } }
.zk-bot-face { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 6px; width: 33px; height: 26px; margin-top: 6px; border: 2px solid #22645f; border-radius: 10px; background: var(--zk-mint); box-shadow: inset 0 -4px #72c9ae; }
.zk-bot-face::before { content: ''; position: absolute; top: -9px; left: 14px; width: 11px; height: 7px; transform: rotate(-26deg); border: 1px solid #22645f; border-radius: 90% 10% 90% 20%; background: #86deae; }
.zk-bot-face > span { width: 4px; height: 6px; border-radius: 50%; background: #154b49; }
.zk-bot-face::after { content: ''; position: absolute; bottom: 4px; width: 6px; height: 3px; border-bottom: 1px solid #154b49; border-radius: 0 0 5px 5px; }
.zk-chat-panel { position: absolute; right: 0; bottom: calc(100% + 12px); display: flex; flex-direction: column; width: min(392px, calc(100vw - 36px)); height: min(580px, calc(100dvh - 105px)); border: 1px solid var(--zk-line); border-radius: 20px; background: #fff; box-shadow: 0 12px 45px #102b423b; overflow: hidden; }
.zk-chat-head { display: flex; flex: none; gap: 13px; align-items: center; padding: 15px 16px; background: linear-gradient(115deg, #102b42, #1a5155); color: #fff; }
.zk-chat-head h2 { margin: 0; font-size: 17px; line-height: 1.3; color: inherit; letter-spacing: 0; }
.zk-chat-head p { margin: 3px 0 0; color: #cbefe8; font-size: 12px; }
.zk-chat-close { margin-left: auto; display: grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0; border: 1px solid #ffffff52; border-radius: 10px; color: #fff; background: transparent; font-size: 24px !important; }
.zk-chat-close:hover { background: #ffffff22; }
.zk-chat-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px; background: #f5f9f9; }
.zk-chat-log { display: grid; justify-items: start; gap: 10px; }
.zk-chat-message { max-width: 93%; margin: 0; padding: 9px 12px; border: 1px solid #dce9e9; border-radius: 4px 13px 13px; color: var(--zk-ink); background: #fff; overflow-wrap: anywhere; white-space: pre-line; }
.zk-chat-message a { display: block; margin-top: 7px; color: var(--zk-teal); font-weight: 700; text-decoration: underline; }
.zk-chat-generated { display: block; margin-bottom: 3px; color: #466373; font-size: 12px; }
.zk-chat-question { justify-self: end; border-color: #c7e6dd; border-radius: 13px 4px 13px 13px; background: #dcf1e9; }
.zk-chat-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.zk-chat-quick button, .zk-chat-human button { min-height: 36px; padding: 5px 10px; border: 1px solid #a8d1c8; border-radius: 999px; color: #105850; background: #fff; font-size: 13px; }
.zk-chat-quick button:hover:not(:disabled), .zk-chat-human button:hover { background: #e8f7f2; }
.zk-chat-human { display: flex; flex: none; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--zk-line); }
.zk-chat-count { margin: 0; color: #466373; font-size: 12px; }
.zk-chat-options { display: flex; flex: none; flex-wrap: wrap; gap: 8px 12px; padding: 0 14px 8px; }
.zk-chat-options a { color: #1568a5; font-size: 13px; font-weight: 700; text-decoration: underline; }
.zk-chat-compose { display: flex; flex: none; gap: 8px; margin: 0; padding: 0 14px; }
.zk-chat-compose input { flex: 1; min-width: 0; height: 44px; border: 1px solid #9cb8c0; border-radius: 8px; padding: 8px 10px; color: var(--zk-ink); background: #fff; font: inherit; }
.zk-chat-compose button { flex: none; min-height: 44px; padding: 6px 13px; border: 1px solid var(--zk-teal); border-radius: 8px; color: #fff; background: var(--zk-teal); font-weight: 700; }
.zk-chat-note { flex: none; margin: 7px 14px 11px; color: #466373; font-size: 12px; }
.zk-chat-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 560px) {
  .zk-chat { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .zk-chat-panel { width: min(392px, calc(100vw - 24px)); height: min(560px, calc(100dvh - 94px)); }
  .zk-chat-compose input { font-size: 16px; }
}
