/* Animals. The slide is 6:5, so a square board 86% tall is 71.7% wide.
   ponytail: hand-computed — change both numbers if the viewport ratio changes. */
#animals-board {
  position: absolute;
  top: 7%;
  left: 4%;
  width: 71.7%;
  height: 86%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 3px;
  touch-action: none;   /* a finger sliding across the board moves the preview, not the page */
  user-select: none;
  -webkit-user-select: none;
}
.animals-cell {
  position: relative;
  background: rgba(29, 47, 79, 0.75);
  border-radius: 6px;
  cursor: pointer;
}
.animals-cell.target {
  background: rgba(244, 208, 137, 0.3);
  box-shadow: inset 0 0 0 2px var(--amber-hot);
}
.animals-bird {
  position: absolute;
  top: 6%; left: 6%;
  width: 88%; height: 88%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}
.animals-bird[data-type="1"] { background-image: url('/static/animals/red.png'); }
.animals-bird[data-type="2"] { background-image: url('/static/animals/green.png'); }
.animals-bird[data-type="3"] { background-image: url('/static/animals/blue.png'); }
.animals-bird[data-type="4"] { background-image: url('/static/animals/yellow.png'); }
.animals-bird.leaving { transition: transform 0.4s ease-out, opacity 0.4s ease-out; transform: scale(1.5); opacity: 0; }
#animals-side {
  position: absolute;
  top: 7%;
  left: 78%;
  width: 19%;
  text-align: center;
  color: var(--text-soft);
}
#animals-next {
  display: flex;
  justify-content: center;
  margin: 0 auto 10px;
}
#animals-next.vertical { flex-direction: column; align-items: center; }
#animals-next .animals-bird {
  position: relative;
  top: auto; left: auto;
  width: 44px; height: 44px;
}
.animals-bird.ghost { opacity: 0.5; }
.animals-score {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  color: var(--amber-hot);
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  animation: animals-score-float 1s ease-out forwards;
}
@keyframes animals-score-float {
  from { opacity: 1; margin-top: 0; }
  to   { opacity: 0; margin-top: -30px; }
}
#animals-count { font-size: 1.6rem; color: var(--amber-hot); line-height: 1; }
#animals-count-label { font-size: 0.7rem; }
#animals-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(13, 21, 38, 0.85);
  color: var(--text-soft);
  font-size: 1.2rem;
  text-align: center;
  cursor: pointer;
  overflow: hidden;   /* falling animals start above and end below */
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}
#animals-overlay small { font-size: 0.8rem; margin-top: 8px; }
#animals-hint { margin: 12px 0 0; font-size: 0.65rem; line-height: 1.3; }
.animals-parade { display: flex; margin-bottom: 10px; }
.animals-parade .animals-bird {
  position: relative;
  top: auto; left: auto;
  width: 48px; height: 48px;
  margin: 0 4px;   /* not flex gap: Silk's Chromium predates it */
  animation: animals-hop 0.6s ease-in-out infinite alternate;
}
@keyframes animals-hop {
  from { transform: translateY(0); }
  to   { transform: translateY(-14px) rotate(-6deg); }
}
.animals-bird.falling {
  top: -15%;
  width: 36px; height: 36px;
  z-index: -1;
  opacity: 0;
  animation: animals-fall linear 3;   /* a few waves, then the sky clears */
}
@keyframes animals-fall {
  from { opacity: 0.5; top: -15%; transform: rotate(0); }
  to   { opacity: 0.5; top: 105%; transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .animals-parade .animals-bird, .animals-bird.falling { animation: none; }
}
