/* ── Pet Companion Overlay ────────────────────────────────────────────────── */

#pet-companion {
  position: fixed;
  bottom: 90px;
  right: 12px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  user-select: none;
  width: 68px;
}

/* Sit higher in lesson screen to clear the feedback bar + check button */
#pet-companion.pet-in-lesson {
  bottom: 148px;
}

.pet-body {
  font-size: 50px;
  line-height: 1;
  display: block;
  transform-origin: center bottom;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.18));
}

.pet-bubble {
  background: rgba(255,255,255,0.97);
  border: 1.5px solid rgba(31,158,149,0.22);
  border-radius: 14px 14px 14px 2px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #2a2320;
  box-shadow: 0 2px 12px rgba(0,0,0,0.13);
  text-align: center;
  line-height: 1.4;
  font-family: 'Vazirmatn', sans-serif;
  white-space: normal;
  max-width: 130px;
  opacity: 0;
  transform: scale(0.82) translateY(5px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.pet-bubble.show {
  opacity: 1;
  transform: none;
}

/* ── Emotion-driven animations ────────────────────────────────────────────── */

.pet-idle     .pet-body { animation: petBob      2.4s ease-in-out infinite; }
.pet-happy    .pet-body { animation: petBounce   0.55s cubic-bezier(0.34,1.56,0.64,1) both; }
.pet-sad      .pet-body { animation: petDroop    0.5s  ease-out forwards; }
.pet-bored    .pet-body { animation: petSway     2.0s  ease-in-out 2 both; }
.pet-excited  .pet-body { animation: petExcited  0.7s  cubic-bezier(0.34,1.56,0.64,1) both; }
.pet-thumbsup .pet-body { animation: petPop      0.45s cubic-bezier(0.34,1.56,0.64,1) both; }

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

@keyframes petBounce {
  0%   { transform: translateY(0)    scale(1)    rotate(0); }
  35%  { transform: translateY(-24px) scale(1.2) rotate(-10deg); }
  65%  { transform: translateY(-10px) scale(1.08) rotate(5deg); }
  85%  { transform: translateY(-3px)  scale(1.02) rotate(-1deg); }
  100% { transform: translateY(0)    scale(1)    rotate(0); }
}

@keyframes petDroop {
  0%   { transform: translateY(0)   rotate(0deg); }
  30%  { transform: translateY(6px)  rotate(-18deg); }
  100% { transform: translateY(4px)  rotate(-12deg); }
}

@keyframes petSway {
  0%, 100% { transform: rotate(0deg)   translateY(0); }
  20%       { transform: rotate(-14deg) translateY(2px); }
  50%       { transform: rotate(12deg)  translateY(-3px); }
  80%       { transform: rotate(-8deg)  translateY(1px); }
}

@keyframes petExcited {
  0%   { transform: scale(0.85) translateY(0)    rotate(0); }
  20%  { transform: scale(1.35) translateY(-38px) rotate(20deg); }
  40%  { transform: scale(1.15) translateY(-20px) rotate(-12deg); }
  60%  { transform: scale(1.28) translateY(-32px) rotate(16deg); }
  80%  { transform: scale(1.05) translateY(-8px)  rotate(-4deg); }
  100% { transform: scale(1)    translateY(0)    rotate(0); }
}

@keyframes petPop {
  0%   { transform: scale(0.7)  rotate(-5deg); }
  55%  { transform: scale(1.25) rotate(8deg); }
  80%  { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1)    rotate(0); }
}

/* ── Pets collection screen ───────────────────────────────────────────────── */

.pets-intro {
  padding: 10px 16px 0;
  font-size: 13.5px;
  color: #9b8d7e;
  text-align: center;
  line-height: 1.5;
}

.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 14px 16px 32px;
}

.pet-card {
  background: var(--cream);
  border: 2px solid rgba(31,158,149,0.14);
  border-radius: 18px;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
}

.pet-card-active {
  border-color: var(--turquoise);
  background: linear-gradient(145deg, #e8f7f6, #f4fdfc);
  box-shadow: 0 4px 18px rgba(31,158,149,0.14);
}

.pet-card-locked {
  opacity: 0.6;
}

.pet-card-anim {
  font-size: 54px;
  line-height: 1.1;
  display: block;
  transform-origin: center bottom;
}

.pet-card-active .pet-card-anim {
  animation: petBob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 3px 10px rgba(31,158,149,0.28));
}

.pet-locked-anim {
  filter: grayscale(1) opacity(0.45);
}

.pet-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.active-pet-badge {
  background: var(--leaf);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 20px;
}

.locked-pet-badge {
  background: #d0cac3;
  color: #6b5f55;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 20px;
}

.pet-card-desc {
  font-size: 11.5px;
  color: #9b8d7e;
  line-height: 1.45;
}
