.data-pet {
  --data-pet-size: 82px;
  --data-pet-gap: 14px;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.data-pet-toggle {
  position: relative;
  display: grid;
  width: var(--data-pet-size);
  height: var(--data-pet-size);
  padding: 0;
  place-items: center;
  border: 0;
  overflow: visible;
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(230, 255, 251, .94), rgba(234, 243, 255, .94));
  box-shadow: 0 12px 30px rgba(19, 194, 194, .3);
  color: #fff;
  cursor: pointer;
  touch-action: none;
  line-height: 1;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: pet-float 3s ease-in-out infinite;
}

.data-pet-toggle > img {
  width: 94px;
  height: 94px;
  max-width: none;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(16, 24, 40, .2));
}

.data-pet-toggle:hover,
.data-pet-toggle:focus-visible {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 16px 34px rgba(22, 119, 255, .4);
  outline: 3px solid rgba(22, 119, 255, .18);
}

.data-pet-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #12b76a;
}

.data-pet-panel {
  position: absolute;
  right: 0;
  bottom: calc(var(--data-pet-size) + var(--data-pet-gap));
  display: grid;
  width: min(370px, calc(100vw - 28px));
  height: min(520px, calc(100vh - 120px));
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid #d9e2ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(16, 24, 40, .22);
  transform-origin: bottom right;
}

.data-pet-open-right .data-pet-panel {
  right: auto;
  left: 0;
  transform-origin: bottom left;
}

.data-pet-open-down .data-pet-panel {
  top: calc(var(--data-pet-size) + var(--data-pet-gap));
  bottom: auto;
  transform-origin: top right;
}

.data-pet-open-right.data-pet-open-down .data-pet-panel {
  transform-origin: top left;
}

.data-pet-panel[hidden] { display: none; }

.data-pet-head {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #e6fffb, #eaf3ff);
  border-bottom: 1px solid #d9e2ec;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.data-pet-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.data-pet-avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .72);
  object-fit: contain;
}

.data-pet-name { font-size: 15px; font-weight: 700; color: #172b4d; }
.data-pet-mode { margin-top: 3px; color: #667085; font-size: 11px; }
.data-pet-head-actions { display: flex; align-items: center; gap: 6px; cursor: default; }
.data-pet-close,
.data-pet-settings-toggle {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  color: #475467;
  cursor: pointer;
  font-size: 20px;
}

.data-pet-settings-toggle { font-size: 15px; }
.data-pet-settings {
  grid-row: 2;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid #d9e2ec;
  background: #fffdf5;
}

.data-pet-settings[hidden] { display: none; }
.data-pet-settings select,
.data-pet-settings input {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #c7d3df;
  border-radius: 7px;
  background: #fff;
  font: 12px inherit;
}

.data-pet-model { grid-column: 2 / 4; }
.data-pet-api-key { grid-column: 1 / 3; }
.data-pet-settings-save {
  grid-column: 3;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: #1677ff;
  color: #fff;
  cursor: pointer;
  font: 600 12px inherit;
}

.data-pet-settings-note {
  grid-column: 1 / -1;
  color: #667085;
  font-size: 11px;
  line-height: 1.4;
}

.data-pet-messages {
  grid-row: 3;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
}

.data-pet-message {
  width: fit-content;
  max-width: 88%;
  margin-bottom: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.data-pet-message.assistant {
  border: 1px solid #d9e2ec;
  border-bottom-left-radius: 4px;
  background: #fff;
  color: #344054;
}

.data-pet-message.user {
  margin-left: auto;
  border-bottom-right-radius: 4px;
  background: #1677ff;
  color: #fff;
}

.data-pet-message.thinking { color: #667085; }
.data-pet-quick {
  grid-row: 4;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  border-top: 1px solid #edf1f5;
  background: #fff;
}

.data-pet-quick button {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #b8d5ff;
  border-radius: 999px;
  background: #f0f6ff;
  color: #1756a9;
  cursor: pointer;
  font: 12px inherit;
}

.data-pet-form {
  grid-row: 5;
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #edf1f5;
  background: #fff;
}

.data-pet-input {
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid #c7d3df;
  border-radius: 9px;
  font: 13px inherit;
}

.data-pet-send {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: #1677ff;
  color: #fff;
  cursor: pointer;
  font: 600 13px inherit;
}

.data-pet-send:disabled { opacity: .55; cursor: wait; }
.data-pet .data-pet-close:hover:not(:disabled),
.data-pet .data-pet-settings-toggle:hover:not(:disabled) {
  background: #eaf3ff;
  color: #1756a9;
}
.data-pet .data-pet-quick button:hover:not(:disabled) {
  border-color: #8bbcff;
  background: #e7f1ff;
  color: #174f96;
}
.data-pet .data-pet-settings-save:hover:not(:disabled),
.data-pet .data-pet-send:hover:not(:disabled) {
  background: #0958d9;
  color: #fff;
}
.data-pet-dragging,
.data-pet-dragging * { cursor: grabbing !important; }
.data-pet-dragging .data-pet-toggle { animation: none; }

@keyframes pet-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

@media (max-width: 560px) {
  .data-pet { --data-pet-size: 70px; right: 14px; bottom: 14px; }
  .data-pet-toggle > img { width: 74px; height: 74px; }
  .data-pet-panel { position: fixed; inset: 12px 12px 82px; width: auto; height: auto; }
  .data-pet-settings { grid-template-columns: 90px minmax(0, 1fr); }
  .data-pet-model { grid-column: 2; }
  .data-pet-api-key { grid-column: 1 / -1; }
  .data-pet-settings-save { grid-column: 1 / -1; }
}
