#mx-ryuu-pet {
  --ryuu-size: 160px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1040; /* abaixo das janelas (modal 1050+) e do suporte */
  width: var(--ryuu-size);
  height: var(--ryuu-size);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  will-change: transform;
}
#mx-ryuu-pet.mx-ryuu-ready { opacity: 1; }

.mx-ryuu-body {
  position: absolute;
  inset: 0;
  transform-origin: 50% 96%;
}
#mx-ryuu-pet[data-state="held"] .mx-ryuu-body { transform-origin: 50% 8%; }

.mx-ryuu-sprite {
  position: absolute;
  inset: 0;
  background: transparent no-repeat 0 0;
  pointer-events: none;
}
#mx-ryuu-pet[data-state="walk"] .mx-ryuu-sprite { animation: mx-ryuu-bob .29s ease-in-out infinite alternate; }

/* área de clique só no corpo, o resto do quadrado deixa clicar no site */
.mx-ryuu-hit {
  position: absolute;
  left: 24%;
  right: 24%;
  top: 8%;
  bottom: 3%;
  border-radius: 40%;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}
#mx-ryuu-pet[data-state="held"] .mx-ryuu-hit { cursor: grabbing; }

/* sombra no chão: o JS desce ela até o chão e diminui quando ele sobe */
.mx-ryuu-shadow {
  position: absolute;
  left: 28%;
  right: 28%;
  bottom: 2px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(8, 20, 48, .35), rgba(8, 20, 48, 0));
  pointer-events: none;
}

/* poeirinha ao bater no chão */
.mx-ryuu-dust {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 0;
  pointer-events: none;
}
.mx-ryuu-dust::before,
.mx-ryuu-dust::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 26px;
  height: 14px;
  border-radius: 50%;
  background: rgba(190, 200, 220, .8);
  opacity: 0;
}
.mx-ryuu-dust::before { right: 14px; }
.mx-ryuu-dust::after { left: 14px; }
#mx-ryuu-pet.mx-ryuu-puff .mx-ryuu-dust::before { animation: mx-ryuu-puff-l .5s ease-out; }
#mx-ryuu-pet.mx-ryuu-puff .mx-ryuu-dust::after { animation: mx-ryuu-puff-r .5s ease-out; }

/* estrelinhas de tonto (ele está sentado, cabeça mais baixa) */
.mx-ryuu-stars {
  position: absolute;
  left: 50%;
  top: 22%;
  width: 0;
  height: 0;
  display: none;
}
#mx-ryuu-pet[data-state="dizzy"] .mx-ryuu-stars { display: block; }
.mx-ryuu-stars::before,
.mx-ryuu-stars::after {
  content: '★';
  position: absolute;
  color: #ffd23f;
  font-size: 20px;
  text-shadow: 0 0 6px rgba(255, 210, 63, .7);
  margin: -12px 0 0 -10px;
  animation: mx-ryuu-orbit .8s linear infinite;
}
.mx-ryuu-stars::after { animation-delay: -.4s; }

/* Zzz dormindo */
.mx-ryuu-zzz {
  position: absolute;
  left: 66%;
  top: 22%;
  display: none;
  pointer-events: none;
}
#mx-ryuu-pet[data-state="sleep"] .mx-ryuu-zzz { display: block; }
.mx-ryuu-zzz::before,
.mx-ryuu-zzz::after {
  content: 'z';
  position: absolute;
  color: #8fc2ff;
  font: 800 18px/1 var(--font-heading, Manrope, sans-serif);
  text-shadow: 0 1px 2px rgba(8, 20, 48, .4);
  opacity: 0;
  animation: mx-ryuu-z 2.4s ease-out infinite;
}
.mx-ryuu-zzz::after { font-size: 13px; animation-delay: -1.2s; }

@keyframes mx-ryuu-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-2px); }
}
@keyframes mx-ryuu-orbit { /* elipse em volta da cabeça */
  0%   { transform: translate(-44px, 0) scale(1); }
  25%  { transform: translate(0, -9px) scale(.7); opacity: .7; }
  50%  { transform: translate(44px, 0) scale(1); }
  75%  { transform: translate(0, 9px) scale(1.2); }
  100% { transform: translate(-44px, 0) scale(1); }
}
@keyframes mx-ryuu-z {
  0%   { transform: translate(0, 0) scale(.6); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(22px, -46px) scale(1.2); opacity: 0; }
}
@keyframes mx-ryuu-puff-l {
  0%   { transform: translateX(0) scale(.4); opacity: .9; }
  100% { transform: translateX(-26px) scale(1.4); opacity: 0; }
}
@keyframes mx-ryuu-puff-r {
  0%   { transform: translateX(0) scale(.4); opacity: .9; }
  100% { transform: translateX(26px) scale(1.4); opacity: 0; }
}

@media (max-width: 767.98px) {
  #mx-ryuu-pet { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  #mx-ryuu-pet { transition: none; }
  .mx-ryuu-sprite { animation: none !important; }
}
@media (max-width: 1023.98px) {   /* notebook com zoom e tablet: um pouco menor */
  #mx-ryuu-pet { --ryuu-size: 128px; }
}
@media (min-width: 1600px) {
  #mx-ryuu-pet { --ryuu-size: 176px; }
}
