#zihaoPet {
  position: absolute;
  z-index: 12;
  inset: 0 auto auto 0;
  width: 192px;
  aspect-ratio: 1;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
#zihaoPetSprite { width: 100%; height: 100%; display: block; pointer-events: none; }
#zihaoPet.zihao-pet-left img { transform: scaleX(-1); }
#zihaoPetBody {
  position: absolute;
  inset: 12% 31% 10%;
  border-radius: 48% 48% 26% 26%;
  padding: 0;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
#zihaoPet[data-state="drag"] #zihaoPetBody { cursor: grabbing; }
#zihaoPet[data-state="sleep-loop"] #zihaoPetBody { inset: 36% 30% 10%; cursor: pointer; }
#zihaoPetBody:focus-visible { outline: 2px solid white; outline-offset: 4px; box-shadow: 0 0 0 7px #255f91; }
#zihaoPetMenu {
  position: absolute;
  z-index: 16;
  min-width: 166px;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 16px);
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #ffffffa6;
  border-radius: 12px;
  background: rgb(245 245 247 / 94%);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 0 0 1px #18223130, 0 6px 24px #10182736;
}
#zihaoPetMenu button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  color: #25282d;
  text-align: start;
  font: 500 13px/1.5 var(--os-font);
  outline: none;
  box-shadow: none;
}
#zihaoPetMenu button:is(:hover,:focus-visible):enabled { color: white; background: #2963b7; }
#zihaoPetMenu button:disabled { opacity: .44; cursor: default; }
#zihaoPetMobile { display: none; }
@media (min-width:741px) {
  #zihaoPetMenu [role="menuitemradio"] { padding-inline-end:34px; position:relative; }
  #zihaoPetMenu [role="menuitemradio"][aria-checked="true"]::after { content:"✓";position:absolute;right:11px; }
  #zihaoPet[data-mode="work"] #zihaoPetBody,
  #zihaoPet[data-mode="relax"] #zihaoPetBody { inset:12% 40% 10% 21%; }
  #zihaoPetBubble {
    position:absolute;z-index:15;width:max-content;max-width:min(310px,calc(100% - 16px));
    padding:11px 14px 13px;border:1px solid #cbc9c5;border-radius:15px;
    color:#28272a;background:#fffefa;box-shadow:0 4px 16px #2823212e;
    font:400 13px/1.45 var(--os-font);overflow-wrap:anywhere;
  }
  #zihaoPetBubble::after { content:"";position:absolute;left:var(--tip-x);width:10px;height:10px;
    background:#fffefa;transform:translateX(-50%) rotate(45deg); }
  #zihaoPetBubble[data-side="above"]::after {bottom:-6px;border-right:1px solid #cbc9c5;border-bottom:1px solid #cbc9c5;}
  #zihaoPetBubble[data-side="below"]::after {top:-6px;border-left:1px solid #cbc9c5;border-top:1px solid #cbc9c5;}
  #zihaoPetBubble header {display:flex;align-items:center;justify-content:space-between;gap:12px;}
  #zihaoPetBubble header strong {font-size:12px;color:#59545a;}
  #zihaoPetBubble .pet-bubble-close {border:0;border-radius:50%;color:#514c50;background:#edeae6;
    width:22px;height:22px;font:16px/20px var(--os-font);padding:0;}
  #zihaoPetBubble p {margin:4px 0 0;white-space:pre-line;max-height:24vh;overflow:auto;}
  #zihaoPetBubble[data-kind="chat"] {width:304px;}
  #zihaoPetBubble .pet-questions {display:flex;flex-wrap:wrap;gap:5px;margin-top:8px;max-height:18vh;overflow:auto;}
  #zihaoPetBubble .pet-questions:empty {display:none;}
  #zihaoPetBubble .pet-questions :is(a,button) {display:inline-block;text-align:start;border:1px solid #d7d4cd;
    background:#f4f2ee;border-radius:8px;padding:4px 7px;font:inherit;color:#25496b;text-decoration:none;}
  #zihaoPetBubble form {display:flex;gap:6px;margin-top:10px;}
  #zihaoPetBubble form input {min-width:0;flex:1;border:1px solid #c0bdb9;border-radius:8px;background:white;
    color:#222;padding:6px 8px;font:inherit;}
  #zihaoPetBubble form button {width:32px;color:white;background:#285f9a;border:0;border-radius:8px;font:600 18px var(--os-font);}
  #zihaoPetBubble :is(input,a,button):focus-visible {outline:2px solid #326ead;outline-offset:1px;}
}
@media (max-width: 740px) {
  #zihaoPet { width: 116px; z-index: 2; }
  #zihaoPetMenu { z-index: 13; }
  #zihaoPetMenu button { min-height: 44px; font-size: 15px; }
  body[data-ios-screen="home"] #zihaoPetMobile {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: -6px;
    padding: 9px;
    pointer-events: auto;
    color: inherit;
    background: none;
  }
  #zihaoPetMobile svg { width: 22px; height: 22px; }
}
