:root {
  --bg1: #fffbf0;
  --ink: #1a1a1a;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);

  --pink: #ff4fa3;
  --blue: #4aa3ff;
  --yellow: #ffd84a;
  --green: #3be38a;
  --purple: #8a5cff;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial;
  color: var(--ink);
  background:
    radial-gradient(
      800px 400px at 10% 10%,
      rgba(255, 79, 163, 0.25),
      transparent 60%
    ),
    radial-gradient(
      800px 400px at 90% 20%,
      rgba(74, 163, 255, 0.25),
      transparent 60%
    ),
    radial-gradient(
      800px 400px at 40% 90%,
      rgba(59, 227, 138, 0.22),
      transparent 60%
    ),
    linear-gradient(180deg, var(--bg1), #ffffff);
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  width: min(980px, 92vw);
  margin: 0 auto;
  padding: 28px 0 60px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 20px;
  background:
    radial-gradient(220px 120px at 12% 20%, rgba(255, 216, 74, 0.22), transparent 70%),
    radial-gradient(240px 140px at 85% 25%, rgba(74, 163, 255, 0.2), transparent 72%),
    radial-gradient(260px 150px at 50% 100%, rgba(255, 79, 163, 0.14), transparent 75%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 251, 245, 0.86));
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.brand {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  justify-self: start;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-align: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.brand-carousel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  justify-self: center;
  align-self: center;
}

.logo-bubble {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: conic-gradient(
    from 180deg,
    var(--pink),
    var(--yellow),
    var(--green),
    var(--blue),
    var(--purple),
    var(--pink)
  );
  box-shadow: var(--shadow);
}

.brand-carousel {
  width: 64px;
  height: 64px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,249,240,0.92)) padding-box,
    linear-gradient(135deg, rgba(255,216,74,0.45), rgba(74,163,255,0.35), rgba(255,79,163,0.28)) border-box;
  border: 2px solid transparent;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  justify-self: center;
  position: relative;
}

.brand-carousel-img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
  transform-origin: center bottom;
  position: relative;
  z-index: 2;
}

.brand-carousel-img.is-flicking {
  animation: brandAnimalPop 520ms cubic-bezier(.2,.8,.2,1);
}

.brand-carousel::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.85), transparent 55%),
    linear-gradient(180deg, #e9f6ff 0%, #fff6ea 100%);
  border: 1px solid rgba(0,0,0,0.04);
  z-index: 0;
}

.brand-carousel::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 9px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
  z-index: 1;
}

.brand-logo {
  width: 334px;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, auto));
  gap: 8px;
  justify-content: center;
  width: auto;
  max-width: none;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(0, 0, 0, 0.05);
  justify-self: end;
}

.nav a {
  text-align: center;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}

.nav a:nth-child(3n + 1) {
  background: rgba(255, 216, 74, 0.35);
}

.nav a:nth-child(3n + 2) {
  background: rgba(74, 163, 255, 0.28);
}

.nav a:nth-child(3n) {
  background: rgba(255, 79, 163, 0.22);
}

.nav a:hover {
  text-decoration: none;
  opacity: 0.96;
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.14);
}

@keyframes brandAnimalPop {
  0% { opacity: 0; transform: translateY(14px) scale(0.78); }
  50% { opacity: 1; transform: translateY(-2px) scale(1.06); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.hero {
  margin-top: 12px;
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.hero p {
  margin: 0;
  font-size: 18px;
  opacity: 0.9;
  max-width: 60ch;
}

.hero .sparkles {
  position: absolute;
  right: -40px;
  top: -40px;
  width: 220px;
  height: 220px;
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(255, 216, 74, 0.9),
      transparent 55%
    ),
    radial-gradient(
      circle at 70% 60%,
      rgba(255, 79, 163, 0.65),
      transparent 55%
    ),
    radial-gradient(circle at 40% 80%, rgba(74, 163, 255, 0.6), transparent 55%);
  filter: blur(2px);
  border-radius: 50%;
  opacity: 0.9;
  pointer-events: none;
}

.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.card {
  grid-column: span 6;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.07);
}

.card h2 {
  margin: 0 0 8px;
}
.card p {
  margin: 0 0 12px;
  opacity: 0.9;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 16px;
  line-height: 1.2;
  padding: 10px 14px;
  border-radius: 14px;
  background: #f8a1a1;
  color: rgb(0, 0, 0);
  font-weight: 700;
  border: 0;
  cursor: pointer;
  transition: opacity 0.12s ease;
}
.button:hover {
  opacity: 0.92;
  text-decoration: none;
}

@media (max-width: 720px) {
  .topbar {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 12px;
    gap: 10px;
    align-items: stretch;
  }

  .brand {
    padding: 0;
    flex-direction: row;
    align-self: center;
    justify-self: auto;
  }

  .nav {
    width: 100%;
    max-width: 560px;
    align-self: center;
    justify-self: auto;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .brand-logo {
    width: 170px;
    height: auto;
    max-height: 72px;
  }

  .brand-carousel-grid {
    gap: 6px;
    justify-self: auto;
    align-self: center;
  }

  .brand-carousel {
    width: 52px;
    height: 52px;
    padding: 4px;
    justify-self: auto;
    align-self: center;
  }
}

.button-stack {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.85);
}

.badge.pink {
  background: rgba(255, 79, 163, 0.18);
}
.badge.blue {
  background: rgba(74, 163, 255, 0.18);
}
.badge.green {
  background: rgba(59, 227, 138, 0.18);
}
.badge.yellow {
  background: rgba(255, 216, 74, 0.22);
}

.footer {
  margin-top: 26px;
  opacity: 0.75;
  font-size: 14px;
}

@media (max-width: 720px) {
  .card {
    grid-column: span 12;
  }
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.animal-match-page .game-wrap {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: var(--shadow);
  position: relative;
}

.animal-match-page .status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.animal-match-page .prompt {
  font-weight: 900;
  font-size: 18px;
}

.animal-match-page .score {
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(74,163,255,.16);
  border: 1px solid rgba(0,0,0,.06);
}

.animal-match-page .level-picker {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  font-weight: 800;
  padding: 8px 34px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.06);
  background:
    linear-gradient(45deg, transparent 50%, rgba(26,26,26,.7) 50%) calc(100% - 16px) calc(50% - 1px) / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(26,26,26,.7) 50%, transparent 50%) calc(100% - 11px) calc(50% - 1px) / 6px 6px no-repeat,
    rgba(74,163,255,.16);
  box-shadow: none;
  color: inherit;
  cursor: pointer;
}

.animal-match-page .grid-animals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.animal-match-page .grid-animals.locked {
  pointer-events: none;
}

.animal-match-page .animal-btn {
  border: 0;
  padding: 8px;
  border-radius: 18px;
  background:
    linear-gradient(#fff7e8, #fff1d6) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  border: 2px solid transparent;
  box-shadow: 0 10px 18px rgba(0,0,0,.06);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.animal-match-page .animal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(0,0,0,.1);
}

.animal-match-page .animal-btn:active {
  transform: scale(.98);
}

.animal-match-page .animal-btn:focus-visible {
  outline: 3px solid rgba(74,163,255,.45);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 12px 22px rgba(0,0,0,.1);
}

.animal-match-page .animal-btn.is-correct {
  animation: correctPulse .35s ease;
  box-shadow: 0 0 0 3px rgba(59,227,138,.5), 0 14px 24px rgba(0,0,0,.1);
}

.animal-match-page .animal-btn.is-wrong {
  animation: wrongShake .28s ease;
  box-shadow: 0 0 0 3px rgba(255,79,163,.35), 0 12px 20px rgba(0,0,0,.08);
}

.animal-match-page .animal {
  width: min(100%, 110px);
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
  box-sizing: border-box;
  border-radius: 14px;
  background: #fff6e8;
  padding: 10px;
}

.animal-match-page .progress-wrap {
  margin: 10px 0 14px;
}

.animal-match-page .progress-label {
  font-size: 13px;
  font-weight: 800;
  opacity: .85;
  margin-bottom: 6px;
}

.animal-match-page .progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.08);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.05);
}

.animal-match-page .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4aa3ff, #3be38a, #ffd84a);
  transition: width .18s ease;
}

.animal-match-page .level-banner {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
}

.animal-match-page .level-banner.show {
  animation: levelBannerInOut 1200ms ease forwards;
}

.animal-match-page .level-banner-chip {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #111;
  background:
    linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.95)) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  border: 2px solid transparent;
  box-shadow: 0 10px 20px rgba(0,0,0,.12);
}

.animal-match-page .msg {
  margin-top: 12px;
  font-weight: 800;
  min-height: 28px;
}

.animal-match-page .game-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.animal-match-page .popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
}

.animal-match-page .popup.hidden {
  display: none;
}

.animal-match-page .popup-card {
  background: white;
  padding: 26px 22px;
  border-radius: 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: popIn 0.2s ease-out;
  width: min(360px, 90vw);
}

.animal-match-page .popup-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.animal-match-page .popup-card p {
  margin: 0 0 14px;
  font-weight: 700;
  opacity: 0.9;
}

.animal-match-page .confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}

.animal-match-page .confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: .95;
  animation: confettiFall var(--dur, 1200ms) ease-out forwards;
  animation-delay: var(--delay, 0ms);
  transform: translate3d(0, 0, 0) rotate(0deg);
  will-change: transform, opacity;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
}

@keyframes levelBannerInOut {
  0% { opacity: 0; transform: translateY(-6px) scale(.98); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  75% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-4px) scale(.99); }
}

@keyframes confettiFall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  8% {
    opacity: .95;
  }
  100% {
    transform: translate3d(var(--drift, 0px), 105vh, 0) rotate(var(--spin, 360deg));
    opacity: 0;
  }
}

@media (max-width: 520px) {
  .animal-match-page .grid-animals {
    grid-template-columns: repeat(2, 1fr);
  }

  .animal-match-page .animal {
    width: min(100%, 96px);
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .animal-match-page .level-banner.show {
    animation-duration: 1ms;
  }

  .animal-match-page .confetti-piece {
    animation-duration: 1ms;
  }
}

.animal-memory-page .memory-wrap {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: var(--shadow);
  position: relative;
}

.animal-memory-page .status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.animal-memory-page .memory-title {
  font-weight: 900;
  font-size: 18px;
}

.animal-memory-page .pill {
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(74,163,255,.16);
  border: 1px solid rgba(0,0,0,.06);
}

.animal-memory-page .pill.soft {
  background: rgba(255,255,255,.7);
}

.animal-memory-page .level-picker {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  font-weight: 800;
  padding: 8px 34px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.06);
  background:
    linear-gradient(45deg, transparent 50%, rgba(26,26,26,.7) 50%) calc(100% - 16px) calc(50% - 1px) / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(26,26,26,.7) 50%, transparent 50%) calc(100% - 11px) calc(50% - 1px) / 6px 6px no-repeat,
    rgba(74,163,255,.16);
  color: inherit;
  cursor: pointer;
}

.animal-memory-page .progress-wrap {
  margin: 10px 0 14px;
}

.animal-memory-page .progress-label {
  font-size: 13px;
  font-weight: 800;
  opacity: .85;
  margin-bottom: 6px;
}

.animal-memory-page .progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.08);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.05);
}

.animal-memory-page .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4aa3ff, #3be38a, #ffd84a);
  transition: width .18s ease;
}

.animal-memory-page .memory-grid {
  display: grid;
  gap: 12px;
}

.animal-memory-page .memory-grid.locked {
  pointer-events: none;
}

.animal-memory-page .memory-card {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 18px;
  perspective: 800px;
}

.animal-memory-page .memory-card:focus-visible {
  outline: 3px solid rgba(74,163,255,.45);
  outline-offset: 3px;
}

.animal-memory-page .memory-card-inner {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  transform-style: preserve-3d;
  transition: transform .22s ease;
}

.animal-memory-page .memory-card.is-flipped .memory-card-inner,
.animal-memory-page .memory-card.is-matched .memory-card-inner {
  transform: rotateY(180deg);
}

.animal-memory-page .memory-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  backface-visibility: hidden;
  border: 2px solid transparent;
  box-shadow: 0 10px 18px rgba(0,0,0,.07);
}

.animal-memory-page .memory-back {
  background:
    linear-gradient(#fff7e8, #fff1d6) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  font-size: clamp(26px, 4vw, 34px);
}

.animal-memory-page .memory-front {
  transform: rotateY(180deg);
  background:
    linear-gradient(rgba(255,255,255,.96), rgba(255,255,255,.96)) padding-box,
    linear-gradient(135deg, #4aa3ff, #3be38a, #ffd84a) border-box;
  padding: 8px;
}

.animal-memory-page .memory-animal-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: #fff6e8;
  padding: 8px;
}

.animal-memory-page .memory-animal {
  width: min(100%, 92px);
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.animal-memory-page .memory-card:hover .memory-face {
  box-shadow: 0 14px 24px rgba(0,0,0,.1);
}

.animal-memory-page .memory-card.is-correct .memory-face {
  box-shadow: 0 0 0 3px rgba(59,227,138,.5), 0 14px 24px rgba(0,0,0,.1);
  animation: correctPulse .35s ease;
}

.animal-memory-page .memory-card.is-wrong .memory-face {
  box-shadow: 0 0 0 3px rgba(255,79,163,.35), 0 12px 20px rgba(0,0,0,.08);
  animation: wrongShake .28s ease;
}

.animal-memory-page .memory-card.is-matched {
  cursor: default;
}

.animal-memory-page .memory-card.is-matched .memory-front {
  background:
    linear-gradient(rgba(255,255,255,.96), rgba(255,255,255,.96)) padding-box,
    linear-gradient(135deg, #3be38a, #ffd84a) border-box;
}

.animal-memory-page .memory-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.animal-memory-page .msg {
  margin-top: 12px;
  font-weight: 800;
  min-height: 28px;
}

.animal-memory-page .game-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.animal-memory-page .level-banner {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
}

.animal-memory-page .level-banner.show {
  animation: levelBannerInOut 1200ms ease forwards;
}

.animal-memory-page .level-banner-chip {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #111;
  background:
    linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.95)) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  border: 2px solid transparent;
  box-shadow: 0 10px 20px rgba(0,0,0,.12);
}

.animal-memory-page .popup-card {
  width: min(380px, 92vw);
}

.animal-memory-page .popup-card p {
  margin: 0 0 14px;
  font-weight: 700;
  opacity: .9;
}

.animal-memory-page .confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}

.animal-memory-page .confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: .95;
  animation: confettiFall var(--dur, 1200ms) ease-out forwards;
  animation-delay: var(--delay, 0ms);
  transform: translate3d(0, 0, 0) rotate(0deg);
  will-change: transform, opacity;
}

@media (max-width: 520px) {
  .animal-memory-page .memory-grid {
    gap: 10px;
  }

  .animal-memory-page .memory-animal {
    width: min(100%, 76px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .animal-memory-page .level-banner.show,
  .animal-memory-page .memory-card-inner,
  .animal-memory-page .progress-fill {
    transition: none;
    animation-duration: 1ms;
  }

  .animal-memory-page .confetti-piece {
    animation-duration: 1ms;
  }
}

.animal-tap-rush-page .tap-rush-wrap {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: var(--shadow);
  position: relative;
}

.animal-tap-rush-page .status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.animal-tap-rush-page .tap-rush-prompt {
  font-weight: 900;
  font-size: 18px;
}

.animal-tap-rush-page .tap-pill {
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(74,163,255,.16);
  border: 1px solid rgba(0,0,0,.06);
}

.animal-tap-rush-page .level-picker {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  font-weight: 800;
  padding: 8px 34px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.06);
  background:
    linear-gradient(45deg, transparent 50%, rgba(26,26,26,.7) 50%) calc(100% - 16px) calc(50% - 1px) / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(26,26,26,.7) 50%, transparent 50%) calc(100% - 11px) calc(50% - 1px) / 6px 6px no-repeat,
    rgba(74,163,255,.16);
  color: inherit;
  cursor: pointer;
}

.animal-tap-rush-page .progress-wrap {
  margin: 10px 0 14px;
}

.animal-tap-rush-page .progress-label {
  font-size: 13px;
  font-weight: 800;
  opacity: .85;
  margin-bottom: 6px;
}

.animal-tap-rush-page .progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.08);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.05);
}

.animal-tap-rush-page .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4aa3ff, #3be38a, #ffd84a);
  transition: width .18s ease;
}

.animal-tap-rush-page .tap-target-chip {
  margin: 4px 0 14px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 8px 16px rgba(0,0,0,.06);
  font-weight: 800;
}

.animal-tap-rush-page .tap-start-btn {
  margin-left: 4px;
  padding: 8px 12px;
}

.animal-tap-rush-page .tap-target-label {
  opacity: .75;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.animal-tap-rush-page #targetPreview {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  background: #fff6e8;
  border-radius: 10px;
  padding: 4px;
}

.animal-tap-rush-page .tap-grid {
  display: grid;
  gap: 12px;
}

.animal-tap-rush-page .tap-grid.locked {
  pointer-events: none;
}

.animal-tap-rush-page .tap-tile {
  border: 0;
  padding: 8px;
  border-radius: 18px;
  background:
    linear-gradient(#fff7e8, #fff1d6) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  border: 2px solid transparent;
  box-shadow: 0 10px 18px rgba(0,0,0,.06);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .12s ease;
}

.animal-tap-rush-page .tap-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(0,0,0,.1);
}

.animal-tap-rush-page .tap-tile:active {
  transform: scale(.98);
}

.animal-tap-rush-page .tap-tile:focus-visible {
  outline: 3px solid rgba(74,163,255,.45);
  outline-offset: 3px;
}

.animal-tap-rush-page .tap-tile.is-correct {
  animation: correctPulse .35s ease;
  box-shadow: 0 0 0 3px rgba(59,227,138,.5), 0 14px 24px rgba(0,0,0,.1);
}

.animal-tap-rush-page .tap-tile.is-wrong {
  animation: wrongShake .28s ease;
  box-shadow: 0 0 0 3px rgba(255,79,163,.35), 0 12px 20px rgba(0,0,0,.08);
}

.animal-tap-rush-page .tap-tile-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: #fff6e8;
  padding: 8px;
}

.animal-tap-rush-page .tap-tile-img {
  width: min(100%, 92px);
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.animal-tap-rush-page .msg {
  margin-top: 12px;
  font-weight: 800;
  min-height: 28px;
}

.animal-tap-rush-page .game-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.animal-tap-rush-page .level-banner {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
}

.animal-tap-rush-page .level-banner.show {
  animation: levelBannerInOut 1200ms ease forwards;
}

.animal-tap-rush-page .level-banner-chip {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #111;
  background:
    linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.95)) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  border: 2px solid transparent;
  box-shadow: 0 10px 20px rgba(0,0,0,.12);
}

.animal-tap-rush-page .popup-card {
  width: min(380px, 92vw);
}

.animal-tap-rush-page .popup-card p {
  margin: 0 0 14px;
  font-weight: 700;
  opacity: .9;
}

.animal-tap-rush-page .confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}

.animal-tap-rush-page .confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: .95;
  animation: confettiFall var(--dur, 1200ms) ease-out forwards;
  animation-delay: var(--delay, 0ms);
  transform: translate3d(0, 0, 0) rotate(0deg);
  will-change: transform, opacity;
}

@media (max-width: 520px) {
  .animal-tap-rush-page .tap-grid {
    gap: 10px;
  }

  .animal-tap-rush-page .tap-tile-img {
    width: min(100%, 72px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .animal-tap-rush-page .level-banner.show,
  .animal-tap-rush-page .progress-fill {
    transition: none;
    animation-duration: 1ms;
  }

  .animal-tap-rush-page .confetti-piece {
    animation-duration: 1ms;
  }
}

.animal-quiz-page .quiz-wrap {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: var(--shadow);
  position: relative;
}

.animal-quiz-page .status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.animal-quiz-page .quiz-title {
  font-weight: 900;
  font-size: 18px;
}

.animal-quiz-page .quiz-pill {
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(74,163,255,.16);
  border: 1px solid rgba(0,0,0,.06);
}

.animal-quiz-page .level-picker {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  font-weight: 800;
  padding: 8px 34px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.06);
  background:
    linear-gradient(45deg, transparent 50%, rgba(26,26,26,.7) 50%) calc(100% - 16px) calc(50% - 1px) / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(26,26,26,.7) 50%, transparent 50%) calc(100% - 11px) calc(50% - 1px) / 6px 6px no-repeat,
    rgba(74,163,255,.16);
  color: inherit;
  cursor: pointer;
}

.animal-quiz-page .progress-wrap {
  margin: 10px 0 14px;
}

.animal-quiz-page .progress-label {
  font-size: 13px;
  font-weight: 800;
  opacity: .85;
  margin-bottom: 6px;
}

.animal-quiz-page .progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.08);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.05);
}

.animal-quiz-page .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4aa3ff, #3be38a, #ffd84a);
  transition: width .18s ease;
}

.animal-quiz-page .quiz-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(0,0,0,.05);
}

.animal-quiz-page .quiz-image-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background:
    linear-gradient(#fff7e8, #fff1d6) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  border: 2px solid transparent;
  padding: 8px;
  box-shadow: 0 10px 18px rgba(0,0,0,.06);
}

.animal-quiz-page .quiz-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  background: #fff6e8;
  padding: 8px;
}

.animal-quiz-page .quiz-question-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.animal-quiz-page .quiz-question-text {
  font-weight: 900;
  font-size: 20px;
}

.animal-quiz-page .quiz-start-btn {
  padding: 8px 12px;
}

.animal-quiz-page .quiz-options {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.animal-quiz-page .quiz-options.locked {
  pointer-events: none;
}

.animal-quiz-page .quiz-option {
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 800;
  background:
    linear-gradient(rgba(255,255,255,.96), rgba(255,255,255,.96)) padding-box,
    linear-gradient(135deg, rgba(74,163,255,.35), rgba(255,216,74,.45), rgba(255,79,163,.28)) border-box;
  box-shadow: 0 8px 16px rgba(0,0,0,.06);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.animal-quiz-page .quiz-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(0,0,0,.09);
}

.animal-quiz-page .quiz-option:active {
  transform: scale(.99);
}

.animal-quiz-page .quiz-option:focus-visible {
  outline: 3px solid rgba(74,163,255,.45);
  outline-offset: 3px;
}

.animal-quiz-page .quiz-option.is-correct {
  animation: correctPulse .35s ease;
  box-shadow: 0 0 0 3px rgba(59,227,138,.5), 0 14px 24px rgba(0,0,0,.1);
}

.animal-quiz-page .quiz-option.is-wrong {
  animation: wrongShake .28s ease;
  box-shadow: 0 0 0 3px rgba(255,79,163,.35), 0 12px 20px rgba(0,0,0,.08);
}

.animal-quiz-page .msg {
  margin-top: 12px;
  font-weight: 800;
  min-height: 28px;
}

.animal-quiz-page .game-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.animal-quiz-page .level-banner {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
}

.animal-quiz-page .level-banner.show {
  animation: levelBannerInOut 1200ms ease forwards;
}

.animal-quiz-page .level-banner-chip {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #111;
  background:
    linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.95)) padding-box,
    linear-gradient(135deg, #ff8a00, #ffd93d, #6bcB77, #4d96ff, #ff6b9a) border-box;
  border: 2px solid transparent;
  box-shadow: 0 10px 20px rgba(0,0,0,.12);
}

.animal-quiz-page .popup-card {
  width: min(380px, 92vw);
}

.animal-quiz-page .popup-card p {
  margin: 0 0 14px;
  font-weight: 700;
  opacity: .9;
}

.animal-quiz-page .confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}

.animal-quiz-page .confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: .95;
  animation: confettiFall var(--dur, 1200ms) ease-out forwards;
  animation-delay: var(--delay, 0ms);
  transform: translate3d(0, 0, 0) rotate(0deg);
  will-change: transform, opacity;
}

@media (max-width: 640px) {
  .animal-quiz-page .quiz-card {
    grid-template-columns: 1fr;
  }

  .animal-quiz-page .quiz-image-panel {
    width: min(220px, 100%);
    justify-self: center;
  }

  .animal-quiz-page .quiz-question-row {
    justify-content: center;
  }

  .animal-quiz-page .quiz-question-text {
    text-align: center;
    font-size: 18px;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .animal-quiz-page .level-banner.show,
  .animal-quiz-page .progress-fill {
    transition: none;
    animation-duration: 1ms;
  }

  .animal-quiz-page .confetti-piece {
    animation-duration: 1ms;
  }
}

.animal-wordsearch-page .wordsearch-wrap {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: var(--shadow);
}

.animal-wordsearch-page .status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.animal-wordsearch-page .wordsearch-title {
  font-weight: 900;
  font-size: 18px;
}

.animal-wordsearch-page .wordsearch-pill {
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(74,163,255,.16);
  border: 1px solid rgba(0,0,0,.06);
}

.animal-wordsearch-page .level-picker {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  font-weight: 800;
  padding: 8px 34px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.06);
  background:
    linear-gradient(45deg, transparent 50%, rgba(26,26,26,.7) 50%) calc(100% - 16px) calc(50% - 1px) / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(26,26,26,.7) 50%, transparent 50%) calc(100% - 11px) calc(50% - 1px) / 6px 6px no-repeat,
    rgba(74,163,255,.16);
  color: inherit;
  cursor: pointer;
}

.animal-wordsearch-page .wordsearch-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 2.2fr) minmax(220px, 1fr);
}

.animal-wordsearch-page .wordsearch-board {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(0,0,0,.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.animal-wordsearch-page .ws-cell {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  aspect-ratio: 1 / 1;
  min-width: 0;
  background:
    linear-gradient(#fffdf7, #fff6e6) padding-box,
    linear-gradient(135deg, rgba(255,216,74,.35), rgba(74,163,255,.2), rgba(59,227,138,.25)) border-box;
  font: inherit;
  font-weight: 900;
  letter-spacing: .3px;
  color: #141414;
  box-shadow: 0 5px 10px rgba(0,0,0,.05);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .12s ease, background .12s ease;
  user-select: none;
  -webkit-user-select: none;
}

.animal-wordsearch-page .ws-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 14px rgba(0,0,0,.08);
}

.animal-wordsearch-page .ws-cell:focus-visible {
  outline: 3px solid rgba(74,163,255,.45);
  outline-offset: 2px;
}

.animal-wordsearch-page .ws-cell.is-selected {
  background:
    linear-gradient(rgba(255,255,255,.98), rgba(255,255,255,.98)) padding-box,
    linear-gradient(135deg, #4aa3ff, #ffd84a) border-box;
  border-color: transparent;
}

.animal-wordsearch-page .ws-cell.is-start {
  box-shadow: 0 0 0 3px rgba(74,163,255,.2), 0 10px 16px rgba(0,0,0,.09);
}

.animal-wordsearch-page .ws-cell.is-found {
  background:
    linear-gradient(rgba(20,130,66,.96), rgba(11,105,51,.96)) padding-box,
    linear-gradient(135deg, #7df7a8, #22c55e) border-box;
  border-color: transparent;
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
  box-shadow: 0 0 0 2px rgba(26,173,88,.25), 0 10px 16px rgba(0,0,0,.12);
}

.animal-wordsearch-page .wordlist-panel {
  border-radius: 16px;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(0,0,0,.05);
  padding: 12px;
}

.animal-wordsearch-page .wordlist-panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.animal-wordsearch-page .word-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.animal-wordsearch-page .word-chip {
  margin: 0;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.92);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .3px;
}

.animal-wordsearch-page .word-chip.is-found {
  background: linear-gradient(135deg, #1e9a53, #14743d);
  border-color: rgba(8,72,35,.55);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 6px 12px rgba(0,0,0,.12);
}

.animal-wordsearch-page .msg {
  margin-top: 12px;
  font-weight: 800;
  min-height: 28px;
}

.animal-wordsearch-page .game-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.animal-wordsearch-page .popup-card {
  width: min(380px, 92vw);
}

.animal-wordsearch-page .popup-card p {
  margin: 0 0 14px;
  font-weight: 700;
  opacity: .9;
}

@media (max-width: 780px) {
  .animal-wordsearch-page .wordsearch-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .animal-wordsearch-page .wordsearch-board {
    gap: 4px;
    padding: 8px;
  }

  .animal-wordsearch-page .ws-cell {
    border-radius: 8px;
    font-size: 13px;
  }
}

.popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
}

.popup.hidden {
  display: none;
}

.popup-card {
  background: white;
  padding: 30px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: popIn 0.25s ease-out;
}

.popup-card h2 {
  margin-top: 0;
  font-size: 28px;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
