.pet-perch {
  display: flex; justify-content: flex-end; align-items: center; min-height: 54px;
  margin: -5px 0 3px;
}
.pet-perch[hidden], #lumi-pet[hidden], #lumi-pet [hidden] { display: none; }
#lumi-pet { display: flex; align-items: center; gap: 6px; max-width: 100%; }
#lumi-pet.pet-free { position: fixed; z-index: 24; }
#lumi-pet.pet-free[data-sched-watch] { z-index: 34; transition: left .18s ease, top .18s ease; }
body:has(#sheet > .sheet) #lumi-pet:not([data-sched-watch]),
body:has(.ask-wrap) #lumi-pet { visibility: hidden; }
#lumi-pet[data-sched-watch] .pet-stage {
  transform: translate(var(--pet-look-x, 0px), var(--pet-look-y, 0px)) rotate(var(--pet-tilt, 0deg));
  transition: transform .12s ease-out;
}
#lumi-pet[data-sched-watch][data-facing="left"] .pet-stage {
  transform: translate(var(--pet-look-x, 0px), var(--pet-look-y, 0px)) scaleX(-1) rotate(calc(var(--pet-tilt, 0deg) * -1));
}
[data-pet-touch].pet-hop { animation: petHop .26s cubic-bezier(.34,1.56,.64,1); }
@keyframes petHop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-6px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}
:root[data-motion="off"] #lumi-pet[data-sched-watch] .pet-stage,
:root[data-motion="off"] [data-pet-touch].pet-hop { transition: none; animation: none; }
[data-pet-touch] {
  position:relative; flex: none; display: grid; place-items: center; height: 54px; width: 54px; border: 0;
  background: transparent; padding: 0; cursor: grab; touch-action: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none;
}
[data-pet-touch]:active { cursor: grabbing; }
.pet-stage { position:relative; width:100%; height:100%; display:grid; place-items:center; pointer-events:none; }
[data-pet-touch] img.pet-body { position:relative; z-index:1; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
[data-pet-bubble] {
  position:relative; padding: 9px 13px; border-radius: 22px 22px 8px 22px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); font-size: 12px; text-align: left;
  max-width: min(233px, 64vw); line-height: 1.35; overflow-wrap: break-word;
  box-shadow: 0 4px 14px rgba(20, 10, 40, .14); z-index: 26;
}
[data-pet-bubble]::after { content:""; position:absolute; right:-5px; bottom:3px;
  width:10px; height:10px; background:var(--bg); border-right:1px solid var(--line);
  border-bottom:1px solid var(--line); transform:rotate(-18deg); border-radius:0 0 7px 0; }
#lumi-pet.pet-free [data-pet-bubble][data-side="right"]::after { right:auto; left:-5px; transform:scaleX(-1) rotate(-18deg) }
#lumi-pet.pet-free [data-pet-bubble] {
  position: absolute; width: max-content; right: calc(100% + 6px);
}
#lumi-pet.pet-free [data-pet-bubble][data-side="right"] { left: calc(100% + 6px); right: auto; }
.pet-pref { margin: 10px 0; }
#lumi-pet[data-travel] [data-pet-touch] { width:54px; height:54px; }
#lumi-pet[data-facing="left"] .pet-stage { transform:scaleX(-1); }
#lumi-pet[data-travel="sit"] .pet-stage { position:relative; top:7px; }
#lumi-pet[data-travel="jump"] { pointer-events:none; }
#lumi-pet.pet-free[data-panel] { z-index:31; }
.pet-hatch-scene { position:fixed; z-index:32; width:40px; height:120px; pointer-events:none }
.pet-hatch-door { position:absolute; top:-12px; width:40px; height:12px; border:2px solid #dfb2ff;
  border-radius:5px; background:#51239a; transform-origin:top; transition:transform .55s ease }
.pet-hatch-ladder { position:absolute; left:8px; top:0; width:24px; height:120px;
  border-left:3px solid #d8a8ff; border-right:3px solid #d8a8ff; transform-origin:top; transform:scaleY(0);
  background:repeating-linear-gradient(to bottom, transparent 0 12px, #d8a8ff 12px 15px);
  transition:transform .7s ease }
.pet-hatch-scene[data-open="true"] .pet-hatch-door { transform:perspective(50px) rotateX(55deg) }
.pet-hatch-scene[data-open="true"] .pet-hatch-ladder { transform:scaleY(1) }
#lumi-pet[data-hatch] { z-index:33 }
#lumi-pet[data-hatch="remote"] [data-pet-touch]::after { content:"🎮"; position:absolute; right:-4px; bottom:5px; font-size:16px }
#lumi-pet[data-hatch="inside"] { visibility:hidden; pointer-events:none }
#lumi-pet[data-travel="sit"]::after, #lumi-pet[data-travel="walk"]::after {
  content:""; position:absolute; bottom:-1px; left:25%; right:25%; height:3px;
  background:radial-gradient(ellipse, rgba(59, 27, 79, .28), transparent 72%);
  pointer-events:none;
}
/* Гардероб и образы чиби-Люми (3.48) */
[data-pet-touch] img.pet-outfit-img {
  filter:drop-shadow(0 2px 5px rgba(20, 8, 42, .35));
  animation:petBreathe 3.2s ease-in-out infinite;
}
@keyframes petBreathe {
  0%, 100% { transform:translateY(0) scale(1); }
  50% { transform:translateY(-2px) scale(1.02); }
}
.pet-acc {
  position:absolute; pointer-events:none; line-height:1; z-index:2;
  width:40%; height:40%; left:50%; top:0;
  transform:translateX(-50%); transform-origin:50% 45%;
  filter:drop-shadow(0 1px 3px rgba(0,0,0,.35));
  will-change:transform, top, left;
}
.pet-acc img { width:100%; height:100%; object-fit:contain; display:block; }
.pet-acc[data-item="cape"] { z-index:0; transform-origin:50% 12%; }
.pet-acc[data-item="halo"] { filter:drop-shadow(0 0 6px #ffd84d); }
/* Спрайт-вспышка вокруг чиби при праздновании */
.pet-fx-sprite {
  position:fixed; z-index:92; pointer-events:none; width:96px; height:96px; object-fit:contain;
  transform:translate(-50%, -50%);
  animation:petFxPop .9s cubic-bezier(.16,.84,.3,1) forwards;
}
@keyframes petFxPop {
  0% { opacity:0; transform:translate(-50%,-50%) scale(.35) rotate(-10deg); }
  25% { opacity:1; transform:translate(-50%,-55%) scale(1.12) rotate(3deg); }
  80% { opacity:.95; transform:translate(-50%,-62%) scale(1.04) rotate(0deg); }
  100% { opacity:0; transform:translate(-50%,-72%) scale(.88); }
}
:root[data-motion="off"] [data-pet-touch] img.pet-outfit-img,
:root[data-motion="off"] .pet-acc { animation:none; }
