

.hb-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; border: none; border-radius: 50%;
  cursor: pointer; box-shadow: 0 6px 20px -6px rgba(20, 21, 42, .4);
  transition: background .15s ease, transform .12s ease;
}
.hb-btn:hover { background: var(--ink-2) }
.hb-btn:active { transform: scale(.92) }
.hb-btn .hb-dot, .hb-btn .hb-x {
  display: flex; align-items: center; justify-content: center;
  animation: hb-pop .16s ease;
}
.hb-btn .hb-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--accent) }
.hb-btn .hb-x { font-size: 24px; line-height: 1; font-weight: 400 }
@keyframes hb-pop { from { transform: scale(.5); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.hb-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 59;
  width: 340px; max-width: calc(100vw - 32px); height: 460px; max-height: calc(100vh - 108px);
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 48px -16px rgba(20, 21, 42, .28);
  display: flex; flex-direction: column; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  
  opacity: 0; transform: translateY(10px) scale(.98); transform-origin: bottom right;
  pointer-events: none; transition: opacity .16s ease, transform .16s ease;
}
.hb-panel.hb-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto }

.hb-panel[hidden] { display: none !important }
@media (prefers-reduced-motion: reduce) {
  .hb-btn, .hb-btn .hb-dot, .hb-btn .hb-x, .hb-panel { transition: none; animation: none }
}
.hb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.hb-head .hb-title { font-size: 13.5px; font-weight: 700; color: var(--ink) }
.hb-head .hb-sub { font-size: 11px; color: var(--muted); margin-top: 1px }
.hb-restart {
  flex: none; border: 1px solid var(--line); background: #fff; color: var(--sub);
  border-radius: 8px; font: inherit; font-size: 11px; font-weight: 650; padding: 6px 9px; cursor: pointer;
}
.hb-restart:hover { border-color: var(--accent); color: var(--accent-deep) }

.hb-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px }
.hb-msg { font-size: 13.5px; line-height: 1.55; padding: 9px 12px; border-radius: 12px; max-width: 88% }
.hb-msg.bot { background: var(--chip); color: var(--ink-2); align-self: flex-start; border-bottom-left-radius: 4px }
.hb-msg.user { background: var(--ink); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px }
.hb-msg.err { background: #fffbeb; color: #92400e; align-self: flex-start; border-bottom-left-radius: 4px }
.hb-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px }
.hb-sources a {
  font-size: 11px; font-weight: 650; color: var(--accent-deep); background: #fff;
  border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; text-decoration: none;
}
.hb-sources a:hover { border-color: var(--accent) }
.hb-typing {
  align-self: flex-start; display: flex; align-items: center; gap: 4px;
  background: var(--chip); border-radius: 12px; border-bottom-left-radius: 4px; padding: 11px 14px;
}
.hb-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: hb-bounce 1.1s infinite ease-in-out }
.hb-typing span:nth-child(2) { animation-delay: .15s }
.hb-typing span:nth-child(3) { animation-delay: .3s }
@keyframes hb-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-4px); opacity: 1 } }
@media (prefers-reduced-motion: reduce) {
  .hb-typing span { animation: none; opacity: .8 }
}

.hb-esc { align-self: flex-start; max-width: 92%; background: var(--chip); border-radius: 12px; padding: 10px 12px; border-bottom-left-radius: 4px }
.hb-esc p { margin: 0 0 8px; font-size: 12.5px; color: var(--sub) }
.hb-esc form { display: flex; gap: 6px; flex-wrap: wrap }

.hb-esc .hb-captcha { flex-basis: 100%; order: 3 }
.hb-esc .hb-captcha:empty { display: none }
.hb-esc input[type="email"] {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  font: inherit; font-size: 12.5px;
}
.hb-esc button {
  border: none; background: var(--accent); color: #fff; border-radius: 8px;
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 7px 11px; cursor: pointer;
}
.hb-esc button:hover { background: var(--accent-deep) }
.hb-esc button:disabled { opacity: .6; cursor: default }

.hb-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line) }
.hb-form input[type="text"] {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font: inherit; font-size: 13.5px;
}
.hb-form input[type="text"]:focus { outline: none; border-color: var(--accent) }
.hb-form button {
  border: none; background: var(--ink); color: #fff; border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 700; padding: 9px 14px; cursor: pointer;
}
.hb-form button:hover { background: var(--ink-2) }
.hb-form button:disabled { opacity: .55; cursor: default }

@media (max-width: 420px) {
  .hb-panel { right: 12px; left: 12px; width: auto; bottom: 80px; max-height: calc(100vh - 100px) }
  .hb-btn { right: 12px; bottom: 12px }
}
