/* Hub 桌宠客服 — 预览挂件（Ink Teal，交互容器允许面板形态） */

.hub-pet {
  --pet-size: 112px;
  position: fixed;
  z-index: 9999;
  right: 1.25rem;
  bottom: 1.25rem;
  width: var(--pet-size);
  height: var(--pet-size);
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}

.hub-pet[hidden] {
  display: none !important;
}

.hub-pet-avatar {
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  cursor: grab;
  background: transparent;
  border-radius: 50%;
  filter: drop-shadow(0 10px 18px rgba(12, 18, 21, 0.22));
  transition: transform 0.35s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.hub-pet-avatar:active {
  cursor: grabbing;
}

.hub-pet-avatar:focus-visible {
  outline: 2px solid var(--teal, #0d6e69);
  outline-offset: 3px;
}

.hub-pet-figure {
  display: block;
  width: 100%;
  height: 100%;
}

.hub-pet.is-idle .hub-pet-avatar {
  animation: hub-pet-bob 2.8s var(--ease, ease-in-out) infinite;
}

.hub-pet.is-thinking .hub-pet-avatar {
  animation: hub-pet-think 0.9s ease-in-out infinite;
}

.hub-pet.is-open .hub-pet-avatar {
  transform: scale(0.92);
}

@keyframes hub-pet-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes hub-pet-think {
  0%,
  100% {
    transform: rotate(-4deg) scale(1);
  }
  50% {
    transform: rotate(4deg) scale(1.04);
  }
}

.hub-pet-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(22.5rem, calc(100vw - 2rem));
  max-height: min(28rem, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border: 1px solid var(--line-strong, rgba(12, 18, 21, 0.22));
  border-radius: 0.5rem;
  box-shadow: 0 18px 40px rgba(12, 18, 21, 0.16);
  overflow: hidden;
  transform-origin: bottom right;
  animation: hub-pet-panel-in 0.28s var(--ease, ease-out);
}

.hub-pet-panel[hidden] {
  display: none !important;
}

@keyframes hub-pet-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hub-pet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--line, rgba(12, 18, 21, 0.12));
  background: linear-gradient(165deg, #f3f7f7 0%, #fff 55%);
}

.hub-pet-head strong {
  display: block;
  font-family: var(--font-display, "Syne", sans-serif);
  font-size: var(--text-md, 0.875rem);
  font-weight: 700;
  color: var(--ink, #0c1215);
}

.hub-pet-head p {
  margin: 0.2rem 0 0;
  font-size: var(--text-xs, 0.75rem);
  color: var(--ink-soft, #3d4f56);
  line-height: 1.4;
}

.hub-pet-close {
  border: none;
  background: transparent;
  color: var(--ink-soft, #3d4f56);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem;
}

.hub-pet-close:hover {
  color: var(--ink, #0c1215);
}

.hub-pet-msgs {
  flex: 1;
  overflow: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--paper, #f6f7f8);
  min-height: 12rem;
}

.hub-pet-bubble {
  max-width: 92%;
  padding: 0.55rem 0.7rem;
  border-radius: 0.4rem;
  font-size: var(--text-sm, 0.8125rem);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.hub-pet-bubble.is-bot {
  align-self: flex-start;
  background: var(--surface, #fff);
  border: 1px solid var(--line, rgba(12, 18, 21, 0.12));
  color: var(--ink, #0c1215);
}

.hub-pet-bubble.is-user {
  align-self: flex-end;
  background: var(--teal, #0d6e69);
  color: #fff;
}

.hub-pet-bubble.is-meta {
  align-self: stretch;
  max-width: none;
  background: transparent;
  border: none;
  color: var(--ink-soft, #3d4f56);
  font-size: var(--text-xs, 0.75rem);
  padding: 0.15rem 0;
}

.hub-pet-refs {
  margin-top: 0.35rem;
  font-size: var(--text-xs, 0.75rem);
  color: var(--teal-deep, #08554f);
}

.hub-pet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.hub-pet-actions a,
.hub-pet-actions button {
  font: inherit;
  font-size: var(--text-xs, 0.75rem);
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 0.3rem;
  border: 1px solid var(--teal, #0d6e69);
  background: var(--teal, #0d6e69);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.hub-pet-actions a.is-ghost,
.hub-pet-actions button.is-ghost {
  background: transparent;
  color: var(--teal-deep, #08554f);
}

.hub-pet-compose {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--line, rgba(12, 18, 21, 0.12));
  background: var(--surface, #fff);
}

.hub-pet-compose input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-strong, rgba(12, 18, 21, 0.22));
  border-radius: 0.3rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: var(--text-sm, 0.8125rem);
  background: var(--foam, #eef2f3);
  color: var(--ink, #0c1215);
}

.hub-pet-compose input:focus {
  outline: 2px solid rgba(13, 110, 105, 0.35);
  outline-offset: 1px;
  background: #fff;
}

.hub-pet-compose button[type="submit"] {
  border: none;
  border-radius: 0.3rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: var(--text-sm, 0.8125rem);
  font-weight: 600;
  background: var(--ink, #0c1215);
  color: #fff;
  cursor: pointer;
}

.hub-pet-compose button[type="submit"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hub-pet-hint {
  padding: 0 0.75rem 0.55rem;
  font-size: 0.6875rem;
  color: var(--ink-soft, #3d4f56);
  background: var(--surface, #fff);
}

@media (max-width: 560px) {
  .hub-pet {
    --pet-size: 64px;
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .hub-pet-panel {
    width: min(20.5rem, calc(100vw - 1.25rem));
  }
}
