/*
 * 小曜 · Orrery 桌面宠物 —— 角色样式（参考资产）
 *
 * 结构与约束见 SPEC.md。要点：
 * - 画布固定 200×200；外部用 transform: scale() 适配尺寸。
 * - 所有颜色走 --pet-* 变量，四套配色由 [data-palette] 切换。
 * - 视觉只认 [data-look]（= 当前一次性动作 ?? 基础状态），由 pet.js 计算写入。
 * - 只动 transform / opacity；唯一例外是月亮层的 z-index 阶跃（每圈两次）。
 */

/* ═════════ 配色 ═════════ */
.pet,
.pet-icon {
  /* 默认青：orrery-os / cupertino / nord / solarized / flexoki / things / adwaita */
  --pet-body-0: #f0fdfa;
  --pet-body-1: #a5f3fc;
  --pet-body-2: #5eead4;
  --pet-body-3: #22d3ee;
  --pet-body-4: #0e7490;
  --pet-glow: rgba(34, 211, 238, 0.35);
  --pet-shade: rgba(14, 116, 144, 0.45);
  --pet-crater: rgba(14, 116, 144, 0.18);
  --pet-ring-a: #5eead4;
  --pet-ring-b: #a5f3fc;
  --pet-ring-c: #60a5fa;
  --pet-moon-0: #fffbeb;
  --pet-moon-1: #fde68a;
  --pet-moon-2: #f59e0b;
  --pet-moon-glow: rgba(253, 230, 138, 0.55);
  --pet-ink: #1e2a4a;
  --pet-blush: rgba(251, 113, 133, 0.42);
  --pet-tongue: #fb7185;
  --pet-spark-1: #fde68a;
  --pet-spark-2: #5eead4;
  --pet-spark-3: #a5f3fc;
  --pet-outline: rgba(14, 116, 144, 0.35);
}

/* 暖色：gruvbox / catppuccin / ayu / sanctum / tiniri / everforest */
[data-palette='warm'] {
  --pet-body-0: #fff7ed;
  --pet-body-1: #fed7aa;
  --pet-body-2: #fdba74;
  --pet-body-3: #fb923c;
  --pet-body-4: #c2410c;
  --pet-glow: rgba(251, 146, 60, 0.35);
  --pet-shade: rgba(194, 65, 12, 0.4);
  --pet-crater: rgba(194, 65, 12, 0.16);
  --pet-ring-a: #fde68a;
  --pet-ring-b: #fef3c7;
  --pet-ring-c: #a3e635;
  --pet-moon-0: #f0fdf4;
  --pet-moon-1: #bbf7d0;
  --pet-moon-2: #22c55e;
  --pet-moon-glow: rgba(187, 247, 208, 0.55);
  --pet-ink: #3b2414;
  --pet-blush: rgba(244, 63, 94, 0.38);
  --pet-spark-1: #fef08a;
  --pet-spark-2: #a3e635;
  --pet-spark-3: #fed7aa;
  --pet-outline: rgba(194, 65, 12, 0.35);
}

/* 紫粉：linear / dracula / atom / rose-pine / sky */
[data-palette='violet'] {
  --pet-body-0: #faf5ff;
  --pet-body-1: #e9d5ff;
  --pet-body-2: #c4b5fd;
  --pet-body-3: #a78bfa;
  --pet-body-4: #6d28d9;
  --pet-glow: rgba(167, 139, 250, 0.38);
  --pet-shade: rgba(109, 40, 217, 0.4);
  --pet-crater: rgba(109, 40, 217, 0.15);
  --pet-ring-a: #f9a8d4;
  --pet-ring-b: #fbcfe8;
  --pet-ring-c: #c4b5fd;
  --pet-moon-0: #fff1f2;
  --pet-moon-1: #fecdd3;
  --pet-moon-2: #fb7185;
  --pet-moon-glow: rgba(254, 205, 211, 0.6);
  --pet-ink: #2e1065;
  --pet-blush: rgba(244, 114, 182, 0.5);
  --pet-tongue: #f472b6;
  --pet-spark-1: #fbcfe8;
  --pet-spark-2: #c4b5fd;
  --pet-spark-3: #f0abfc;
  --pet-outline: rgba(109, 40, 217, 0.35);
}

/* 素墨：inkapaper / notion（单色 + 一点月亮黄） */
[data-palette='ink'] {
  --pet-body-0: #ffffff;
  --pet-body-1: #f8fafc;
  --pet-body-2: #e2e8f0;
  --pet-body-3: #cbd5e1;
  --pet-body-4: #64748b;
  --pet-glow: rgba(148, 163, 184, 0.28);
  --pet-shade: rgba(71, 85, 105, 0.35);
  --pet-crater: rgba(71, 85, 105, 0.14);
  --pet-ring-a: #94a3b8;
  --pet-ring-b: #64748b;
  --pet-ring-c: #94a3b8;
  --pet-moon-0: #fefce8;
  --pet-moon-1: #fde047;
  --pet-moon-2: #ca8a04;
  --pet-moon-glow: rgba(253, 224, 71, 0.5);
  --pet-ink: #0f172a;
  --pet-blush: rgba(251, 113, 133, 0.35);
  --pet-spark-1: #fde047;
  --pet-spark-2: #94a3b8;
  --pet-spark-3: #cbd5e1;
  --pet-outline: rgba(51, 65, 85, 0.4);
}

/* ═════════ 角色骨架：200×200 画布 ═════════ */
.pet {
  position: relative;
  width: 200px;
  height: 200px;
  --lx: 0px;
  --ly: 0px;
  user-select: none;
  -webkit-user-select: none;
}

.pet * {
  position: absolute;
}

.pet__stage {
  inset: 0;
  transform-origin: 100px 110px;
}

.pet__float {
  inset: 0;
  animation: pet-float 3.6s ease-in-out infinite;
}

.pet__motion {
  inset: 0;
  transform-origin: 100px 152px;
  transition: transform 0.4s ease;
}

/* 影子：外层随状态静态变化（拎起时缩小变淡），内层跟浮动反相呼吸 */
.pet__shadow-wrap {
  left: 62px;
  top: 176px;
  width: 76px;
  height: 10px;
  transition:
    transform 0.35s ease,
    opacity 0.35s ease;
}

.pet__shadow {
  inset: 0;
  border-radius: 50%;
  background: rgba(2, 6, 23, 0.45);
  filter: blur(2px);
  animation: pet-shadow 3.6s ease-in-out infinite;
}

[data-surface='light'] .pet__shadow {
  background: rgba(15, 23, 42, 0.2);
}

/* 土星环：后半弧在身体后、前半弧在身体前，中间夹身体 */
.pet__ring {
  inset: 0;
  transform-origin: 100px 102px;
  animation: pet-ring-sway 7s ease-in-out infinite alternate;
}

.pet__ring svg {
  inset: 0;
  width: 200px;
  height: 200px;
  overflow: visible;
}

.pet__ring--back {
  z-index: 1;
}

.pet__ring--back svg {
  opacity: 0.55;
}

.pet__ring--front {
  z-index: 3;
}

/* 小月亮：与环同一椭圆；绕到前半周时抬到最前，后半周压到身体后 */
.pet__moon-layer {
  inset: 0;
  animation: pet-moon-z 8s linear -2.6s infinite;
}

.pet__moon-sway {
  inset: 0;
  transform-origin: 100px 102px;
  animation: pet-ring-sway 7s ease-in-out infinite alternate;
}

.pet__tilt {
  left: 15px;
  top: 17px;
  width: 170px;
  height: 170px;
  transform: rotate(-14deg) scaleY(0.2706);
}

.pet__orbit {
  inset: 0;
  animation: pet-spin 8s linear -2.6s infinite;
}

.pet__moon {
  left: 78px;
  top: -7px;
  width: 14px;
  height: 14px;
  animation: pet-counter 8s linear -2.6s infinite;
}

.pet__moon::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    var(--pet-moon-0),
    var(--pet-moon-1) 55%,
    var(--pet-moon-2)
  );
  box-shadow: 0 0 10px 2px var(--pet-moon-glow);
}

.pet__moon::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 7px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--pet-moon-2);
  opacity: 0.45;
}

/* 身体：发光小星球 */
.pet__body {
  z-index: 2;
  left: 50px;
  top: 52px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 34% 28%,
    var(--pet-body-0) 0%,
    var(--pet-body-1) 22%,
    var(--pet-body-2) 48%,
    var(--pet-body-3) 72%,
    var(--pet-body-4) 100%
  );
  box-shadow:
    0 0 28px 4px var(--pet-glow),
    inset -10px -14px 22px var(--pet-shade);
  transition: filter 0.6s ease;
}

[data-surface='light'] .pet__body {
  box-shadow:
    0 0 0 1.5px var(--pet-outline),
    0 6px 18px var(--pet-glow),
    inset -10px -14px 22px var(--pet-shade);
}

.pet__crater {
  border-radius: 50%;
  background: var(--pet-crater);
}

.pet__crater--a {
  left: 66px;
  top: 22px;
  width: 14px;
  height: 11px;
}

.pet__crater--b {
  left: 78px;
  top: 40px;
  width: 7px;
  height: 6px;
}

.pet__crater--c {
  left: 18px;
  top: 66px;
  width: 9px;
  height: 7px;
}

.pet__spec {
  left: 20px;
  top: 14px;
  width: 22px;
  height: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  filter: blur(2px);
  transform: rotate(-28deg);
}

/* ═════════ 脸 ═════════ */
.pet__face {
  inset: 0;
}

.pet__eyes {
  inset: 0;
  transform: translate(var(--lx), var(--ly));
  transition: transform 0.25s ease-out;
}

.pet__eye {
  top: 38px;
  width: 11px;
  height: 15px;
  border-radius: 50%;
  background: var(--pet-ink);
  transform-origin: 50% 60%;
  animation: pet-blink 4.2s infinite;
}

.pet__eye--l {
  left: 31px;
}

.pet__eye--r {
  left: 58px;
  animation-delay: 0.04s;
}

.pet__eye::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffffff;
}

.pet__brow {
  top: 30px;
  width: 11px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--pet-ink);
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.pet__brow--l {
  left: 31px;
}

.pet__brow--r {
  left: 58px;
}

.pet__blush {
  top: 58px;
  width: 14px;
  height: 7px;
  border-radius: 50%;
  background: var(--pet-blush);
  filter: blur(1px);
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.pet__blush--l {
  left: 19px;
}

.pet__blush--r {
  left: 67px;
}

.pet__mouth {
  left: 44px;
  top: 56px;
  width: 12px;
  height: 6px;
  border: 2.5px solid var(--pet-ink);
  border-top: none;
  border-radius: 0 0 12px 12px;
}

.pet__yawn {
  left: 44px;
  top: 54px;
  width: 12px;
  height: 14px;
  border-radius: 50%;
  background: var(--pet-ink);
  opacity: 0;
  transform: scale(0.2);
}

/* ═════════ 特效层（默认隐藏，按 look 打开） ═════════ */
.pet__fx {
  inset: 0;
  z-index: 5;
  display: none;
  pointer-events: none;
}

.pet__star {
  width: 12px;
  height: 12px;
  background: var(--pet-spark-1);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

/* 思考的三个点 */
.pet__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pet-spark-3);
  animation: pet-dot 1.2s ease-in-out infinite;
}

.pet__dot:nth-child(1) {
  left: 146px;
  top: 46px;
}

.pet__dot:nth-child(2) {
  left: 158px;
  top: 36px;
  animation-delay: 0.2s;
}

.pet__dot:nth-child(3) {
  left: 170px;
  top: 26px;
  animation-delay: 0.4s;
}

/* 执笔时上升的小星星 */
.pet__fx--rise .pet__star {
  animation: pet-sparkle 1.8s ease-out infinite;
}

.pet__fx--rise .pet__star:nth-child(1) {
  left: 150px;
  top: 100px;
}

.pet__fx--rise .pet__star:nth-child(2) {
  left: 140px;
  top: 80px;
  width: 8px;
  height: 8px;
  background: var(--pet-spark-2);
  animation-delay: 0.6s;
}

.pet__fx--rise .pet__star:nth-child(3) {
  left: 158px;
  top: 70px;
  width: 9px;
  height: 9px;
  background: var(--pet-spark-3);
  animation-delay: 1.2s;
}

/* 开心时四周闪烁 */
.pet__fx--pop .pet__star {
  animation: pet-pop 0.9s ease-out infinite;
}

.pet__fx--pop .pet__star:nth-child(1) {
  left: 30px;
  top: 40px;
}

.pet__fx--pop .pet__star:nth-child(2) {
  left: 160px;
  top: 34px;
  width: 10px;
  height: 10px;
  background: var(--pet-spark-2);
  animation-delay: 0.15s;
}

.pet__fx--pop .pet__star:nth-child(3) {
  left: 168px;
  top: 104px;
  width: 8px;
  height: 8px;
  animation-delay: 0.3s;
}

.pet__fx--pop .pet__star:nth-child(4) {
  left: 22px;
  top: 112px;
  width: 9px;
  height: 9px;
  background: var(--pet-spark-3);
  animation-delay: 0.45s;
}

/* 晕乎乎：头顶星星绕圈 */
.pet__halo-tilt {
  left: 60px;
  top: 22px;
  width: 80px;
  height: 80px;
  transform: scaleY(0.3);
}

.pet__halo-spin {
  inset: 0;
  animation: pet-spin 1.2s linear infinite;
}

.pet__halo-spin .pet__star {
  width: 10px;
  height: 10px;
  animation: pet-counter-halo 1.2s linear infinite;
}

.pet__halo-spin .pet__star:nth-child(1) {
  left: 35px;
  top: -5px;
}

.pet__halo-spin .pet__star:nth-child(2) {
  left: 35px;
  top: 75px;
  background: var(--pet-spark-3);
}

/* 汗滴 */
.pet__drop {
  width: 9px;
  height: 13px;
  background: #93c5fd;
  clip-path: polygon(50% 0, 100% 62%, 100% 100%, 0 100%, 0 62%);
  border-radius: 0 0 50% 50%;
  animation: pet-drop 1.6s ease-in infinite;
}

.pet__drop:nth-child(1) {
  left: 138px;
  top: 58px;
}

.pet__drop:nth-child(2) {
  left: 54px;
  top: 64px;
  width: 7px;
  height: 10px;
  animation-delay: 0.8s;
}

/* 睡觉 zzz */
.pet__z {
  color: var(--pet-spark-3);
  font:
    700 14px/1 system-ui,
    sans-serif;
  opacity: 0;
  animation: pet-z 3s ease-out infinite;
}

.pet__z:nth-child(1) {
  left: 140px;
  top: 52px;
}

.pet__z:nth-child(2) {
  left: 152px;
  top: 40px;
  font-size: 11px;
  animation-delay: 1s;
}

.pet__z:nth-child(3) {
  left: 162px;
  top: 30px;
  font-size: 9px;
  animation-delay: 2s;
}

/* 新消息徽标 */
.pet__badge {
  left: 140px;
  top: 34px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pet-spark-1);
  box-shadow: 0 0 10px 2px var(--pet-moon-glow);
  color: var(--pet-ink);
  font:
    800 14px/22px system-ui,
    sans-serif;
  text-align: center;
  animation: pet-badge 1.6s ease-in-out infinite;
}

/* 整理知识：星星从四周飞进环里 */
.pet__fx--gather .pet__star {
  left: var(--tx);
  top: var(--ty);
  width: 9px;
  height: 9px;
  opacity: 0;
  animation: pet-gather 2.4s ease-in infinite;
  animation-delay: var(--d);
}

/* 害羞：小爱心 */
.pet__heart {
  color: var(--pet-tongue);
  font:
    14px/1 system-ui,
    sans-serif;
  opacity: 0;
  animation: pet-heart 1.6s ease-out infinite;
}

.pet__heart:nth-child(1) {
  left: 146px;
  top: 60px;
}

.pet__heart:nth-child(2) {
  left: 40px;
  top: 52px;
  font-size: 11px;
  animation-delay: 0.5s;
}

/* 生气：头顶冒烟 */
.pet__puff {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(203, 213, 225, 0.75);
  opacity: 0;
  animation: pet-puff 1.1s ease-out infinite;
}

.pet__puff:nth-child(1) {
  left: 70px;
  top: 44px;
}

.pet__puff:nth-child(2) {
  left: 118px;
  top: 44px;
  animation-delay: 0.35s;
}

.pet__puff:nth-child(3) {
  left: 94px;
  top: 38px;
  width: 9px;
  height: 9px;
  animation-delay: 0.7s;
}

/* 落地扬尘 */
.pet__dust {
  top: 166px;
  width: 14px;
  height: 9px;
  border-radius: 50%;
  background: rgba(203, 213, 225, 0.55);
  opacity: 0;
  animation: pet-dust 0.6s ease-out 0.1s 1 both;
}

.pet__dust:nth-child(1) {
  left: 52px;
  --dx: -14px;
}

.pet__dust:nth-child(2) {
  left: 134px;
  --dx: 14px;
}

/* 出场 / 退场的星光（在 stage 外，不随角色缩放） */
.pet__spawn {
  left: 82px;
  top: 84px;
  width: 36px;
  height: 36px;
  background: var(--pet-spark-1);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

/* ═════════ 状态 / 动作（data-look） ═════════ */

/* — 思考 think（AI 准备中） — */
.pet[data-look='think'] .pet__motion {
  transform: rotate(-7deg);
}
.pet[data-look='think'] .pet__eyes {
  transform: translate(3px, -4px);
}
.pet[data-look='think'] .pet__mouth {
  left: 47px;
  width: 7px;
  height: 7px;
  border: 2.5px solid var(--pet-ink);
  border-radius: 50%;
}
.pet[data-look='think'] .pet__fx--dots {
  display: block;
}

/* — 执笔 write（AI 回答中） — */
.pet[data-look='write'] .pet__motion {
  animation: pet-nod 0.7s ease-in-out infinite alternate;
}
.pet[data-look='write'] .pet__eyes {
  transform: translate(-2px, 3px);
}
.pet[data-look='write'] .pet__eye {
  top: 40px;
  height: 11px;
}
.pet[data-look='write'] .pet__mouth {
  left: 42px;
  top: 58px;
  width: 9px;
  height: 0;
  border-radius: 0;
}
.pet[data-look='write'] .pet__mouth::after {
  content: '';
  position: absolute;
  left: 5px;
  top: -1px;
  width: 6px;
  height: 6px;
  border-radius: 0 0 6px 6px;
  background: var(--pet-tongue);
}
.pet[data-look='write'] .pet__fx--rise {
  display: block;
}

/* — 写太久 tired（长任务） — */
.pet[data-look='tired'] .pet__motion {
  animation: pet-sag 1.4s ease-in-out infinite alternate;
}
.pet[data-look='tired'] .pet__eyes {
  transform: translate(0, 2px);
}
.pet[data-look='tired'] .pet__eye {
  top: 43px;
  height: 9px;
  border-radius: 2px 2px 6px 6px;
  animation: none;
}
.pet[data-look='tired'] .pet__eye::after {
  top: 1px;
  width: 3px;
  height: 3px;
}
.pet[data-look='tired'] .pet__brow {
  opacity: 1;
  top: 35px;
}
.pet[data-look='tired'] .pet__brow--l {
  transform: rotate(-14deg);
}
.pet[data-look='tired'] .pet__brow--r {
  transform: rotate(14deg);
}
.pet[data-look='tired'] .pet__mouth {
  left: 45px;
  top: 57px;
  width: 10px;
  height: 8px;
  border: none;
  border-radius: 50%;
  background: var(--pet-ink);
  animation: pet-pant 0.5s ease-in-out infinite alternate;
}
.pet[data-look='tired'] .pet__fx--drops {
  display: block;
}

/* — 开心 happy（回答完成，持续态）/ cheer（被摸一下，一次性） — */
.pet[data-look='happy'] .pet__motion {
  animation: pet-jump 0.9s ease-in-out infinite;
}
.pet[data-look='cheer'] .pet__motion {
  animation: pet-jump 0.6s ease-in-out 2;
}
.pet:is([data-look='happy'], [data-look='cheer'], [data-look='shy']) .pet__eyes {
  transform: none;
}
.pet:is([data-look='happy'], [data-look='cheer'], [data-look='shy']) .pet__eye {
  top: 41px;
  width: 13px;
  height: 9px;
  border: 3px solid var(--pet-ink);
  border-bottom: none;
  border-radius: 13px 13px 0 0 / 10px 10px 0 0;
  background: transparent;
  animation: none;
}
.pet:is([data-look='happy'], [data-look='cheer'], [data-look='shy']) .pet__eye::after {
  display: none;
}
.pet:is([data-look='happy'], [data-look='cheer'], [data-look='notify']) .pet__mouth {
  left: 42px;
  top: 55px;
  width: 16px;
  height: 10px;
  overflow: hidden;
  border: none;
  border-radius: 3px 3px 10px 10px;
  background: var(--pet-ink);
}
.pet:is([data-look='happy'], [data-look='cheer'], [data-look='notify']) .pet__mouth::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 5px;
  width: 10px;
  height: 8px;
  border-radius: 50%;
  background: var(--pet-tongue);
}
.pet:is([data-look='happy'], [data-look='cheer']) .pet__blush {
  opacity: 1;
  transform: scale(1.15);
}
.pet:is([data-look='happy'], [data-look='cheer'], [data-look='moonplay']) .pet__fx--pop {
  display: block;
}

/* — 出错 dizzy（遇到小状况） — */
.pet[data-look='dizzy'] .pet__motion {
  animation: pet-wobble 0.55s ease-in-out infinite alternate;
}
.pet[data-look='dizzy'] .pet__eyes {
  transform: none;
}
.pet[data-look='dizzy'] .pet__eye {
  top: 39px;
  width: 13px;
  height: 13px;
  border: 2.5px solid var(--pet-ink);
  background: transparent;
  transform-origin: 50% 50%;
  animation: pet-spin 0.9s linear infinite;
}
.pet[data-look='dizzy'] .pet__eye--l {
  left: 30px;
}
.pet[data-look='dizzy'] .pet__eye::after {
  left: 1.5px;
  top: 1.5px;
  background: var(--pet-ink);
}
.pet:is([data-look='dizzy'], [data-look='angry']) .pet__mouth {
  left: 43px;
  top: 57px;
  width: 14px;
  height: 6px;
  border: 2.5px solid var(--pet-ink);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}
.pet[data-look='dizzy'] .pet__fx--halo,
.pet[data-look='dizzy'] .pet__fx--drops {
  display: block;
}
.pet[data-look='dizzy'] .pet__drop:nth-child(2) {
  display: none;
}

/* — 睡觉 sleep（长时间闲置） — */
.pet[data-look='sleep'] .pet__body {
  filter: saturate(0.6) brightness(0.82);
}
.pet[data-look='sleep'] .pet__motion {
  transform: rotate(5deg);
}
.pet:is([data-look='sleep'], [data-look='yawn']) .pet__eyes {
  transform: none;
}
.pet[data-look='sleep'] .pet__eye {
  top: 44px;
  width: 12px;
  height: 6px;
  border: 2.5px solid var(--pet-ink);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: transparent;
  animation: none;
}
.pet[data-look='sleep'] .pet__eye::after {
  display: none;
}
.pet[data-look='sleep'] .pet__mouth {
  left: 47px;
  top: 58px;
  width: 5px;
  height: 5px;
  border: 2px solid var(--pet-ink);
  border-radius: 50%;
}
.pet[data-look='sleep'] .pet__fx--zzz {
  display: block;
}

/* — 悬停 hover（工具栏出现：抬头看你） — */
.pet[data-look='hover'] .pet__motion {
  transform: translateY(-4px) scale(1.03);
}
.pet[data-look='hover'] .pet__eyes {
  transform: translate(calc(var(--lx) * 0.5), -3px);
}
.pet[data-look='hover'] .pet__eye {
  top: 36px;
  width: 12px;
  height: 17px;
}
.pet[data-look='hover'] .pet__eye::before {
  content: '';
  position: absolute;
  left: 2.5px;
  top: 10px;
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}
.pet[data-look='hover'] .pet__mouth {
  left: 42px;
  width: 16px;
  height: 7px;
}

/* — 新消息 notify（气泡等你点） — */
.pet[data-look='notify'] .pet__motion {
  animation: pet-hop 1.6s ease-out infinite;
}
.pet[data-look='notify'] .pet__eyes {
  transform: translate(2px, -1px);
}
.pet[data-look='notify'] .pet__fx--badge {
  display: block;
}

/* — 被拎起 drag — */
.pet[data-look='drag'] .pet__motion {
  transform-origin: 100px 30px;
  animation: pet-swing 1.3s ease-in-out infinite alternate;
}
.pet[data-look='drag'] .pet__shadow-wrap {
  opacity: 0.3;
  transform: scale(0.55);
}
.pet[data-look='drag'] .pet__eyes {
  transform: none;
}
.pet[data-look='drag'] .pet__eye {
  top: 37px;
  width: 13px;
  height: 13px;
  animation: none;
}
.pet[data-look='drag'] .pet__eye::after {
  left: 6px;
  width: 5px;
  height: 5px;
}
.pet[data-look='drag'] .pet__brow {
  opacity: 1;
  top: 29px;
}
.pet[data-look='drag'] .pet__brow--l {
  transform: rotate(-12deg) translateY(-2px);
}
.pet[data-look='drag'] .pet__brow--r {
  transform: rotate(12deg) translateY(-2px);
}
.pet[data-look='drag'] .pet__mouth {
  left: 45px;
  top: 56px;
  width: 10px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--pet-ink);
}

/* — 落地 land（松手，一次性） — */
.pet[data-look='land'] .pet__motion {
  animation: pet-land 0.55s ease-out 1;
}
.pet[data-look='land'] .pet__fx--dust {
  display: block;
}

/* — 整理知识 organize（Orrery 特色：收集 / 整理资料） — */
.pet[data-look='organize'] .pet__eyes {
  animation: pet-glance 2.4s ease-in-out infinite;
}
.pet[data-look='organize'] .pet__mouth {
  left: 43px;
  width: 14px;
  height: 5px;
  border: none;
}
.pet[data-look='organize'] .pet__mouth::before,
.pet[data-look='organize'] .pet__mouth::after {
  content: '';
  position: absolute;
  top: 0;
  width: 7px;
  height: 5px;
  border: 2.2px solid var(--pet-ink);
  border-top: none;
  border-radius: 0 0 7px 7px;
}
.pet[data-look='organize'] .pet__mouth::before {
  left: 0;
}
.pet[data-look='organize'] .pet__mouth::after {
  left: 6px;
}
.pet[data-look='organize'] .pet__ring--front svg {
  animation: pet-ring-glow 2.4s ease-in-out infinite;
}
.pet[data-look='organize'] .pet__fx--gather {
  display: block;
}

/* — 害羞 shy（连戳 3 下，一次性） — */
.pet[data-look='shy'] .pet__motion {
  transform: rotate(-6deg) scale(0.95);
}
.pet[data-look='shy'] .pet__blush {
  opacity: 1;
  transform: scale(1.5);
  animation: pet-blush 0.8s ease-in-out infinite alternate;
}
.pet[data-look='shy'] .pet__mouth {
  left: 46px;
  width: 8px;
  height: 4px;
}
.pet[data-look='shy'] .pet__fx--hearts {
  display: block;
}

/* — 生气 angry（连戳 5 下，一次性） — */
.pet[data-look='angry'] .pet__motion {
  animation: pet-puff-body 0.45s ease-in-out infinite alternate;
}
.pet[data-look='angry'] .pet__eyes {
  transform: translate(0, 1px);
}
.pet[data-look='angry'] .pet__brow {
  opacity: 1;
  top: 33px;
}
.pet[data-look='angry'] .pet__brow--l {
  transform: rotate(20deg);
}
.pet[data-look='angry'] .pet__brow--r {
  transform: rotate(-20deg);
}
.pet[data-look='angry'] .pet__blush {
  opacity: 1;
  background: rgba(239, 68, 68, 0.55);
  transform: scale(1.3);
}
.pet[data-look='angry'] .pet__fx--steam {
  display: block;
}

/* — 闲置小动作：look（东张西望）/ yawn（打哈欠）/ moonplay（追月亮） — */
.pet[data-look='look'] .pet__eyes {
  animation: pet-look 2.4s ease-in-out 1;
}
.pet[data-look='yawn'] .pet__motion {
  animation: pet-stretch 2.2s ease-in-out 1;
}
.pet[data-look='yawn'] .pet__eye {
  animation: pet-squint 2.2s ease-in-out 1;
}
.pet[data-look='yawn'] .pet__mouth {
  opacity: 0;
}
.pet[data-look='yawn'] .pet__yawn {
  animation: pet-yawn 2.2s ease-in-out 1;
}
.pet[data-look='moonplay'] .pet__motion {
  animation: pet-jump 0.7s ease-in-out 0.5s 1;
}
.pet[data-look='moonplay'] .pet__eyes {
  animation: pet-follow 1.4s ease-in-out 1;
}

/* — 出场 enter / 退场 exit（一次性） — */
.pet[data-look='enter'] .pet__stage {
  animation: pet-enter 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s 1 both;
}
.pet[data-look='enter'] .pet__spawn {
  animation: pet-spawn 0.6s ease-out 1;
}
.pet[data-look='exit'] .pet__stage {
  animation: pet-exit 0.55s ease-in 1 both;
}
.pet[data-look='exit'] .pet__spawn {
  animation: pet-spawn 0.6s ease-out 0.4s 1 both;
}
.pet[data-look='exit'] .pet__shadow-wrap {
  opacity: 0;
}

/* ═════════ 关键帧 ═════════ */
@keyframes pet-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
@keyframes pet-shadow {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.84);
    opacity: 0.6;
  }
}
@keyframes pet-ring-sway {
  from {
    transform: rotate(-3deg);
  }
  to {
    transform: rotate(3deg);
  }
}
@keyframes pet-spin {
  to {
    transform: rotate(360deg);
  }
}
/* 反向旋转 + 反向缩放，抵消 .pet__tilt 的压扁，月亮始终是正圆 */
@keyframes pet-counter {
  from {
    transform: rotate(0deg) scaleY(3.695);
  }
  to {
    transform: rotate(-360deg) scaleY(3.695);
  }
}
@keyframes pet-counter-halo {
  from {
    transform: rotate(0deg) scaleY(3.333);
  }
  to {
    transform: rotate(-360deg) scaleY(3.333);
  }
}
/* 月亮从环顶（后方）出发：0–25% 与 75–100% 在身体后，25–75% 在最前 */
@keyframes pet-moon-z {
  0%,
  24.99% {
    z-index: 1;
  }
  25%,
  74.99% {
    z-index: 4;
  }
  75%,
  100% {
    z-index: 1;
  }
}
@keyframes pet-blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.1);
  }
}
@keyframes pet-dot {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes pet-nod {
  from {
    transform: translateY(0) rotate(0deg);
  }
  to {
    transform: translateY(2px) rotate(2deg);
  }
}
@keyframes pet-sag {
  from {
    transform: translateY(2px) rotate(-2deg);
  }
  to {
    transform: translateY(5px) rotate(2deg);
  }
}
@keyframes pet-pant {
  from {
    transform: scaleY(0.6);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes pet-sparkle {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.3) rotate(0deg);
  }
  25% {
    opacity: 1;
    transform: translate(4px, -8px) scale(1) rotate(30deg);
  }
  100% {
    opacity: 0;
    transform: translate(16px, -42px) scale(0.6) rotate(90deg);
  }
}
@keyframes pet-jump {
  0%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  15% {
    transform: translateY(0) scale(1.08, 0.9);
  }
  45% {
    transform: translateY(-24px) scale(0.95, 1.06);
  }
  70% {
    transform: translateY(0) scale(1.06, 0.94);
  }
  85% {
    transform: translateY(0) scale(0.98, 1.02);
  }
}
@keyframes pet-hop {
  0%,
  40%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  8% {
    transform: translateY(0) scale(1.05, 0.94);
  }
  18% {
    transform: translateY(-12px) scale(0.97, 1.04);
  }
  28% {
    transform: translateY(0) scale(1.04, 0.96);
  }
  34% {
    transform: translateY(-5px);
  }
}
@keyframes pet-pop {
  0% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  40% {
    opacity: 1;
    transform: scale(1.2) rotate(45deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.4) rotate(90deg);
  }
}
@keyframes pet-wobble {
  from {
    transform: rotate(-7deg);
  }
  to {
    transform: rotate(7deg);
  }
}
@keyframes pet-drop {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes pet-z {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(14px, -26px) scale(1.1);
  }
}
@keyframes pet-badge {
  0%,
  60%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  15% {
    transform: scale(1.18) rotate(-10deg);
  }
  30% {
    transform: scale(1.05) rotate(8deg);
  }
}
@keyframes pet-swing {
  from {
    transform: rotate(-6deg) scale(0.97, 1.04);
  }
  to {
    transform: rotate(6deg) scale(0.97, 1.04);
  }
}
@keyframes pet-land {
  0% {
    transform: translateY(-10px) scale(0.96, 1.05);
  }
  35% {
    transform: translateY(0) scale(1.14, 0.84);
  }
  65% {
    transform: translateY(0) scale(0.96, 1.05);
  }
  100% {
    transform: translateY(0) scale(1, 1);
  }
}
@keyframes pet-dust {
  0% {
    opacity: 0.9;
    transform: translateX(0) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translateX(var(--dx)) scale(1.4);
  }
}
@keyframes pet-gather {
  0% {
    opacity: 0;
    transform: translate(var(--fx), var(--fy)) scale(1.2) rotate(0deg);
  }
  20% {
    opacity: 1;
  }
  85% {
    opacity: 1;
    transform: translate(0, 0) scale(0.6) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: translate(0, 0) scale(0.2) rotate(200deg);
  }
}
@keyframes pet-ring-glow {
  0%,
  100% {
    opacity: 0.85;
  }
  80% {
    opacity: 1;
  }
}
@keyframes pet-glance {
  0%,
  100% {
    transform: translate(-3px, -2px);
  }
  50% {
    transform: translate(3px, -1px);
  }
}
@keyframes pet-blush {
  from {
    opacity: 0.75;
  }
  to {
    opacity: 1;
  }
}
@keyframes pet-heart {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  30% {
    opacity: 1;
    transform: translate(2px, -8px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(6px, -30px) scale(0.8);
  }
}
@keyframes pet-puff-body {
  from {
    transform: scale(1, 1) translateX(-1px);
  }
  to {
    transform: scale(1.06, 0.97) translateX(1px);
  }
}
@keyframes pet-puff {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.4);
  }
  30% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translateY(-26px) scale(1.4);
  }
}
@keyframes pet-look {
  0%,
  100% {
    transform: translate(0, 0);
  }
  15%,
  40% {
    transform: translate(-5px, 0);
  }
  55%,
  85% {
    transform: translate(5px, -1px);
  }
}
@keyframes pet-follow {
  0% {
    transform: translate(-4px, 1px);
  }
  50% {
    transform: translate(4px, 2px);
  }
  100% {
    transform: translate(0, 0);
  }
}
@keyframes pet-stretch {
  0%,
  100% {
    transform: scale(1, 1);
  }
  40%,
  60% {
    transform: scale(0.97, 1.06);
  }
}
@keyframes pet-squint {
  0%,
  100% {
    transform: scaleY(1);
  }
  25%,
  75% {
    transform: scaleY(0.15);
  }
}
@keyframes pet-yawn {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.2);
  }
  20% {
    opacity: 1;
    transform: scale(0.5);
  }
  45%,
  65% {
    opacity: 1;
    transform: scale(1);
  }
  85% {
    opacity: 1;
    transform: scale(0.3);
  }
}
@keyframes pet-enter {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes pet-exit {
  0% {
    transform: scale(1) rotate(0deg);
  }
  30% {
    transform: scale(1.08) rotate(4deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(-30deg);
  }
}
@keyframes pet-spawn {
  0% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  40% {
    opacity: 1;
    transform: scale(1.3) rotate(45deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.2) rotate(90deg);
  }
}

/* ═════════ 小尺寸图标版（24–32px：侧边栏 / 托盘 / 通知） ═════════
 * 只保留身体、脸、环；无月亮绕行与特效。尺寸由 font-size 决定（1em = 图标边长）。
 */
.pet-icon {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  font-size: 28px;
  vertical-align: middle;
}

.pet-icon * {
  position: absolute;
}

.pet-icon__ring {
  inset: 0;
  width: 1em;
  height: 1em;
  overflow: visible;
}

.pet-icon__ring-back {
  fill: none;
  stroke: var(--pet-ring-a);
  stroke-width: 5;
  opacity: 0.5;
}

.pet-icon__ring-front {
  fill: none;
  stroke: var(--pet-ring-b);
  stroke-width: 6;
  stroke-linecap: round;
}

.pet-icon__body {
  left: 0.19em;
  top: 0.17em;
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: radial-gradient(
    circle at 34% 28%,
    var(--pet-body-0) 0%,
    var(--pet-body-2) 50%,
    var(--pet-body-3) 78%,
    var(--pet-body-4) 100%
  );
  box-shadow: 0 0 0 0.03em var(--pet-outline);
}

.pet-icon__eye {
  top: 0.22em;
  width: 0.085em;
  height: 0.12em;
  border-radius: 50%;
  background: var(--pet-ink);
  animation: pet-blink 4.2s infinite;
}

.pet-icon__eye--l {
  left: 0.2em;
}

.pet-icon__eye--r {
  left: 0.335em;
}

.pet-icon__mouth {
  left: 0.225em;
  top: 0.36em;
  width: 0.11em;
  height: 0.055em;
  border: 0.03em solid var(--pet-ink);
  border-top: none;
  border-radius: 0 0 0.1em 0.1em;
}

.pet-icon__front {
  inset: 0;
}

/* busy：一颗小月亮绕环（唯一的运动元素） */
.pet-icon__tilt {
  left: 0.06em;
  top: 0.04em;
  width: 0.88em;
  height: 0.88em;
  display: none;
  transform: rotate(-14deg) scaleY(0.2727);
}

.pet-icon__orbit {
  inset: 0;
  animation: pet-spin 1.6s linear infinite;
}

.pet-icon__moon {
  left: 0.36em;
  top: -0.08em;
  width: 0.16em;
  height: 0.16em;
  border-radius: 50%;
  background: var(--pet-moon-1);
  box-shadow: 0 0 0.12em var(--pet-moon-glow);
  animation: pet-icon-counter 1.6s linear infinite;
}

@keyframes pet-icon-counter {
  from {
    transform: rotate(0deg) scaleY(3.667);
  }
  to {
    transform: rotate(-360deg) scaleY(3.667);
  }
}

.pet-icon__badge {
  right: -0.02em;
  top: -0.02em;
  width: 0.3em;
  height: 0.3em;
  border-radius: 50%;
  display: none;
  background: var(--pet-spark-1);
  box-shadow: 0 0 0 0.05em var(--pet-cut, #0a0e1a);
  animation: pet-dot 1.2s ease-in-out infinite;
}

.pet-icon[data-look='busy'] .pet-icon__tilt {
  display: block;
}

.pet-icon[data-look='busy'] .pet-icon__eye {
  top: 0.24em;
  height: 0.09em;
  animation: none;
}

.pet-icon[data-look='attention'] .pet-icon__badge {
  display: block;
}

.pet-icon[data-look='error'] .pet-icon__badge {
  display: block;
  background: #f87171;
}

.pet-icon[data-look='error'] .pet-icon__mouth {
  top: 0.38em;
  border: 0.03em solid var(--pet-ink);
  border-bottom: none;
  border-radius: 0.1em 0.1em 0 0;
}

/* ═════════ 动效降级 ═════════
 * 系统减少动态效果 / 应用内动画总开关关闭（:root[data-animations='off']）时：
 * 全部动画停掉，保留各状态的静态表情与特效构图。
 */
@media (prefers-reduced-motion: reduce) {
  .pet *,
  .pet *::before,
  .pet *::after,
  .pet-icon *,
  .pet-icon *::before,
  .pet-icon *::after {
    animation: none !important;
  }
}
