.animals-page .clouds {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(420px 180px at 12% 18%, rgba(255,255,255,0.7), transparent 70%),
    radial-gradient(520px 220px at 80% 8%, rgba(255, 236, 205, 0.85), transparent 70%),
    radial-gradient(380px 160px at 70% 78%, rgba(255,255,255,0.55), transparent 70%);
}
.animals-page .nav,
.animals-page .page-wrap { position: relative; z-index: 1; }
.animals-page .page-wrap { background: transparent; }

.window.is-open .split.animals-split {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  position: absolute;
  inset: 0;
  min-height: 0;
}
.animal-stage {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 12px 14px 16px;
  background: #efe6d6;
  overflow: hidden;
  transform: none;
}
.animals-page .window:not(.is-open) .book-side {
  display: block !important;
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #efe6d6;
  padding: 0;
}
.animals-page .mem-face img,
.animals-page .mem-back img {
  object-fit: contain !important;
  object-position: center center !important;
  aspect-ratio: auto !important;
}
/* Fixed window. Zoom and the bob stay on the picture inside it. */
.animal-zoom {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  transform: none !important;
  scale: 1;
}
.animals-page .animal-stage:hover .animal-zoom,
.animals-page .animal-zoom:hover {
  transform: none !important;
  scale: 1;
}
.animals-page .animal-stage .animal-photo {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: block;
  background: transparent;
  object-fit: contain !important;
  object-position: center center !important;
  aspect-ratio: auto !important;
  transform-origin: center center;
  transform: none;
  scale: 1;
  transition: scale 1.6s ease, transform 1.6s ease;
  animation: none;
}
.animals-page .animal-stage:hover .animal-photo.m1 {
  scale: 1.08;
  animation: floaterMotion1 3.6s ease-in-out 1.6s infinite;
}
.animals-page .window:not(.is-open) .book-side > img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: cover !important;
  object-position: center center !important;
  aspect-ratio: auto !important;
  background: transparent;
}
.animals-page .window:not(.is-open) {
  container-type: size;
  container-name: animal-strip;
}
.animals-page .strip-name {
  /* About 2× the previous clamp(14px, 1.4vw, 18px), capped so a long name stays in the strip. */
  font-size: min(clamp(28px, 2.8vw, 36px), 78cqw, 4cqh);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-shadow: 0 0 8px rgba(251, 246, 238, 0.95), 0 0 2px rgba(251, 246, 238, 0.95);
  max-width: 100%;
  max-height: 100%;
  padding: 8px 1px;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}
.animals-page .windows > .window.is-open ~ .window .strip-name {
  transform: rotate(360deg);
}
.animal-copy {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: rgba(251, 246, 238, 0.78);
  border-left: 1px solid rgba(44, 39, 34, 0.16);
  padding: 12px 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  text-align: left;
}
.animal-read {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.animal-name {
  font-family: "HN Condensed Black", "Helvetica Neue Condensed Black", "Arial Narrow", Helvetica, sans-serif;
  font-weight: 900;
  font-size: clamp(56px, 6vw, 92px);
  letter-spacing: -0.03em;
  line-height: 0.92;
  margin: 0;
  padding: 14px 40px;
  box-sizing: border-box;
}
.animal-help {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.35;
  margin: 0;
  color: #2c2722;
  padding: 14px 40px 8px;
  box-sizing: border-box;
}
.fact-kicker {
  margin: 0;
  font-family: "HN Condensed Black", "Helvetica Neue Condensed Black", "Arial Narrow", Helvetica, sans-serif;
  font-weight: 900;
  font-size: clamp(32px, 3vw, 48px);
  letter-spacing: -0.03em;
  line-height: 1;
  color: #2c2722;
  padding: 14px 40px;
  box-sizing: border-box;
}
.fact-list {
  margin: 0;
  padding: 0 0 0 1.25em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fact-list li,
.fact-line {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 40px;
  line-height: 1.35;
  color: #2c2722;
}
.fact-line { margin: 0; padding: 10px 40px 14px; box-sizing: border-box; }
.animal-read .study-fact-gap { height: 48px; flex: 0 0 48px; }
.animals-page .animal-copy .high-score { margin: 8px 40px 8px auto; }
.animals-split .animal-copy .play-dock { margin-top: auto; }
.animals-split .study-nav { padding: 16px 18px; }
.animals-split.is-study .animal-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 0;
  overflow: visible;
}
.animals-split.is-study .animal-read {
  grid-row: 1;
  min-height: 0;
  overflow: auto;
  flex: none;
}
.animals-split.is-study .study-nav {
  grid-row: 2;
  align-self: end;
  justify-self: start;
  width: auto;
  max-width: 100%;
  margin: 0;
  position: relative;
  z-index: 3;
  overflow: visible;
}
.animals-split.is-study .play-dock {
  grid-row: 3;
  align-self: end;
  margin-top: 0;
  min-height: 0;
  overflow: visible;
}
.animals-split.is-play .animal-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 0;
  overflow: visible;
}
.animals-split.is-play .animal-read {
  grid-row: 1;
  min-height: 0;
  overflow: auto;
  flex: none;
}
.animals-split.is-play .play-nav {
  grid-row: 2;
  align-self: end;
  justify-self: start;
  width: auto;
  max-width: 100%;
  margin: 0;
  position: relative;
  z-index: 3;
  overflow: visible;
}
.animals-split.is-play .play-dock {
  grid-row: 3;
  align-self: end;
  margin-top: 0;
  min-height: 0;
  overflow: visible;
}
.animals-split .chip {
  border-radius: 999px;
  transform-origin: center center;
  transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.animals-split .chip:hover:not(:disabled),
.animals-split .chip:focus-visible:not(:disabled) {
  transform: scale(1.06);
  background: #111;
  color: #fbf6ee;
  border-color: #111;
}
.play-status {
  font-family: "HN Condensed Black", "Helvetica Neue Condensed Black", "Arial Narrow", Helvetica, sans-serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #1f7a3a;
  text-align: left;
  width: 100%;
  min-height: 0;
}
.play-status:empty { display: none; }

.mem-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 10px;
  box-sizing: border-box;
}
.mem-grid[data-side="6"] {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.mem-grid[data-side="8"] {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
}
.mem-card {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  perspective: 800px;
  font: inherit;
  color: inherit;
  appearance: none;
  transform-origin: center center;
  scale: 1;
}
.mem-card.is-grab,
.mem-card:active:not(:disabled):not(.is-matched) {
  scale: 1.1;
  z-index: 3;
}
.mem-card:disabled,
.mem-card.is-matched { cursor: default; }
.mem-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .45s ease;
  border-radius: 12px;
}
.mem-card.is-up .mem-inner,
.mem-card.is-matched .mem-inner { transform: rotateY(180deg); }
.mem-back,
.mem-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.mem-back {
  background: #efe6d6;
  border: 4px solid #1f7a72;
  box-sizing: border-box;
}
.mem-back.tone-teal { border-color: #1f7a72; }
.mem-back.tone-orange { border-color: #df7429; }
.mem-back.tone-gold { border-color: #c9a04a; }
.mem-back.tone-violet { border-color: #7b57a6; }
.mem-back.tone-green { border-color: #3f8f4a; }
.mem-back img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block;
  object-fit: contain !important;
  object-position: center center !important;
  pointer-events: none;
  background: transparent;
}
.mem-star {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #c9a04a;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
}
.mem-face {
  transform: rotateY(180deg);
  background: #f7f1e6;
  border: 3px solid rgba(44, 39, 34, 0.28);
}
.mem-face img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block;
  object-fit: contain !important;
  object-position: center center !important;
  pointer-events: none;
  background: transparent;
}
.mem-card.is-matched .mem-face { border-color: #1f9d32; }

@media (max-width: 800px) {
  .animals-page .windows { height: auto !important; min-height: 0 !important; }
  .animals-page .window.is-open { height: auto !important; overflow: visible !important; }
  .animals-page .window.is-open .split.animals-split {
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    height: auto !important;
  }
  .animals-page .animal-stage { height: 62vh; min-height: 320px; flex: 0 0 auto; }
  .animals-page .animal-copy {
    height: auto;
    border-left: none;
    border-top: 1px solid rgba(44, 39, 34, 0.16);
  }
  .animals-page .animals-split.is-study .animal-copy {
    height: 70vh;
    min-height: 420px;
  }
  .animals-page .animal-copy { min-height: 280px; }
  .mem-grid { height: 100%; }
}
@media (orientation: portrait) {
  .animals-page .windows { height: 68vh !important; min-height: 480px !important; }
  .animals-page .window.is-open { height: 100% !important; }
}
@media (max-width: 800px) and (orientation: portrait) {
  .animals-page .windows { height: auto !important; min-height: 0 !important; }
  .animals-page .window.is-open { height: auto !important; }
}
