:root {
  color-scheme: light;
  font-family: "Arial Rounded MT Bold", "Noto Sans TC", system-ui, sans-serif;
  background: #b9e7ff;
  color: #183126;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 238, 142, 0.8), transparent 26rem),
    linear-gradient(180deg, #9ee4ff 0%, #d8f7c3 54%, #9fd66e 100%);
  overflow-x: hidden;
}

button,
select {
  font: inherit;
}

.zoo-game {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
}

.home-link,
.soft-btn,
.result-card button,
.result-card a {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: #234033;
  box-shadow: 0 8px 18px rgba(46, 83, 64, 0.18);
  font-weight: 900;
  text-decoration: none;
}

.home-link {
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.title-block p,
.title-block h1 {
  margin: 0;
}

.title-block p {
  font-size: 0.74rem;
  font-weight: 900;
  color: rgba(24, 49, 38, 0.68);
}

.title-block h1 {
  font-size: clamp(1.25rem, 5vw, 2.2rem);
  line-height: 1.02;
}

.language-picker {
  min-width: 112px;
  display: grid;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 900;
  color: rgba(24, 49, 38, 0.7);
}

.language-picker select {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.88);
  color: #183126;
  font-weight: 900;
}

.menu-panel,
.play-panel {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 14px;
}

.cover {
  width: 100%;
  aspect-ratio: 1.2 / 1;
  border-radius: 22px;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 18px 38px rgba(37, 78, 58, 0.22);
}

.menu-copy {
  display: grid;
  gap: 4px;
}

.menu-copy strong {
  font-size: 1.35rem;
}

.menu-copy span {
  color: rgba(24, 49, 38, 0.72);
  font-weight: 800;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stage-card {
  min-height: 92px;
  border: 0;
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 5px;
  text-align: left;
  background: linear-gradient(145deg, #fff9dc, #ffffff);
  color: #214233;
  box-shadow: 0 10px 22px rgba(54, 91, 69, 0.17);
  font-weight: 900;
}

.stage-card.locked {
  filter: grayscale(1);
  opacity: 0.58;
}

.stage-card .stage-icon {
  font-size: 2rem;
}

.stage-card span {
  font-size: 0.86rem;
  color: rgba(33, 66, 51, 0.68);
}

.play-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.soft-btn {
  padding: 0 14px;
}

.progress-line {
  display: grid;
  gap: 5px;
  font-weight: 900;
}

.progress-line div,
.loading-card div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.progress-line i,
.loading-card i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffcf48, #58c56c);
  transition: width 0.28s ease;
}

.animal-card {
  min-height: 300px;
  border-radius: 28px;
  padding: 22px 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.54)),
    url("../../assets/zoo-helper-day-cover.png") center / cover;
  box-shadow: inset 0 0 0 1000px rgba(255, 255, 255, 0.36), 0 18px 34px rgba(48, 82, 63, 0.2);
  text-align: center;
}

.animal-emoji {
  width: min(46vw, 210px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  font-size: clamp(5rem, 24vw, 9rem);
  box-shadow: 0 14px 24px rgba(34, 76, 54, 0.18);
}

.animal-card strong {
  font-size: 1.8rem;
}

.animal-card span {
  min-height: 2.4em;
  display: grid;
  place-items: center;
  font-size: 1.08rem;
  font-weight: 900;
  color: #385342;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.item-card {
  height: clamp(88px, 20vw, 118px);
  border: 0;
  border-radius: 18px;
  padding: 8px 4px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  background: #fff7d0;
  color: #234033;
  box-shadow: 0 10px 20px rgba(47, 86, 64, 0.18);
  font-weight: 900;
  touch-action: manipulation;
}

.item-card b {
  font-size: clamp(2rem, 8vw, 3.1rem);
  line-height: 1;
}

.item-card span {
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
}

.item-card.correct {
  animation: pop 0.34s ease;
  background: #d6ffd7;
}

.item-card.wrong,
.animal-card.wrong {
  animation: shake 0.28s ease;
}

.animal-card.happy {
  animation: happy 0.48s ease;
}

.feedback {
  min-height: 28px;
  text-align: center;
  font-weight: 900;
  color: #234033;
}

.hidden {
  display: none !important;
}

.loading-panel,
.result-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 50, 38, 0.44);
  backdrop-filter: blur(8px);
}

.loading-card,
.result-card {
  width: min(92vw, 420px);
  border-radius: 24px;
  padding: 22px;
  display: grid;
  gap: 12px;
  background: #fffdf0;
  color: #214233;
  text-align: center;
  box-shadow: 0 24px 50px rgba(16, 40, 28, 0.28);
  animation: cardIn 0.28s ease both;
}

.result-card strong {
  font-size: 1.65rem;
}

.stars {
  color: #ffb300;
  font-size: 2.1rem;
  letter-spacing: 0;
}

.result-card button,
.result-card a {
  display: grid;
  place-items: center;
  padding: 10px 14px;
  background: #f8dc76;
}

.result-card button:nth-of-type(2),
.result-card button:nth-of-type(3) {
  background: rgba(255, 255, 255, 0.92);
}

@keyframes cardIn {
  from { transform: translateY(16px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes pop {
  50% { transform: scale(1.08); }
}

@keyframes happy {
  50% { transform: translateY(-7px) scale(1.02); }
}

@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 430px) {
  .zoo-game {
    padding-inline: 10px;
    gap: 10px;
  }

  .topbar {
    grid-template-columns: 44px 1fr 104px;
  }

  .cover {
    aspect-ratio: 1.05 / 1;
  }

  .animal-card {
    min-height: 260px;
  }

  .stage-grid {
    grid-template-columns: 1fr;
  }

  .item-grid {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
html,
body,
button,
a,
canvas,
[role="button"] {
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}
