:root {
  color-scheme: light;
  font-family: "Arial Rounded MT Bold", "Noto Sans TC", system-ui, sans-serif;
  color: #2b261c;
  background: #f5d58a;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  background:
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.95), transparent 12rem),
    radial-gradient(circle at 82% 10%, rgba(255, 206, 68, .55), transparent 16rem),
    linear-gradient(180deg, #69c9ff 0%, #d7f6ff 34%, #f8dd92 64%, #65b85c 100%);
}

button,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.zoo-app {
  width: min(100%, 960px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(34px + env(safe-area-inset-bottom));
  display: grid;
  align-content: start;
  gap: 12px;
}

.topbar {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
}

.topbar p,
.topbar h1 {
  margin: 0;
}

.topbar p {
  font-size: .72rem;
  font-weight: 950;
  opacity: .66;
}

.topbar h1 {
  font-size: clamp(1.35rem, 5vw, 2.4rem);
  line-height: 1;
}

.icon-btn,
.soft-btn,
.menu-copy button,
.zoo-actions button,
.result-card button {
  min-height: 44px;
  border: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fff4bd 0%, #ffcb5a 48%, #df8c27 100%);
  color: #3d2914;
  box-shadow: inset 0 2px rgba(255,255,255,.72), 0 7px 0 #8a5429, 0 16px 28px rgba(82, 48, 18, .22);
  font-weight: 950;
  text-decoration: none;
}

.icon-btn {
  width: 46px;
  aspect-ratio: 1;
}

.menu-panel {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 12px;
}

.menu-copy button {
  position: relative;
  z-index: 3;
}

.zoo-actions button:disabled {
  filter: grayscale(.35);
  opacity: .75;
}

.language-picker {
  min-width: 112px;
  display: grid;
  gap: 4px;
  font-size: .72rem;
  font-weight: 950;
}

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

.cover {
  width: 100%;
  aspect-ratio: 1;
  max-height: 480px;
  border-radius: 24px;
  object-fit: cover;
  background: #fff2c1;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.72), 0 14px 0 #8c6132, 0 24px 46px rgba(66, 43, 20, .28);
}

.menu-copy {
  border-radius: 24px;
  padding: 18px;
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,240,190,.92));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.82), 0 12px 24px rgba(82,48,18,.18);
}

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

.game-panel {
  display: grid;
  gap: 12px;
}

.resource-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.resource-card,
.offline-notice {
  border-radius: 20px;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,239,196,.93));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.7), 0 10px 20px rgba(82,48,18,.14);
  font-weight: 950;
}

.resource-card span {
  font-size: .78rem;
  opacity: .68;
}

.resource-card b {
  font-size: 1.28rem;
}

.offline-notice {
  text-align: center;
  background: #fff2ad;
}

.habitat-grid {
  display: grid;
}

.zoo-stage-card {
  border-radius: 30px;
  padding: 14px;
  display: grid;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255, 248, 221, .98), rgba(245, 200, 118, .94));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.58), 0 14px 0 rgba(136, 94, 49, .78), 0 28px 52px rgba(61, 38, 18, .26);
}

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

.park-hud strong,
.park-hud span {
  min-height: 38px;
  border-radius: 14px;
  padding: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,229,169,.88));
  box-shadow: inset 0 1px rgba(255,255,255,.8), 0 7px 15px rgba(67,43,20,.12);
  font-weight: 950;
  text-align: center;
}

.savanna-stage {
  position: relative;
  min-height: clamp(360px, 58vw, 520px);
  overflow: hidden;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(61,42,15,.08)),
    url("../../assets/animal-zoo-idle-stage-bg.png") center / cover no-repeat;
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.44), inset 0 -18px rgba(61,42,15,.2), 0 16px 30px rgba(46, 60, 30, .18);
}

.savanna-stage::before {
  content: "";
  position: absolute;
  inset: 54% -8% -12%;
  background:
    radial-gradient(ellipse at 18% 48%, rgba(148, 214, 107, .6) 0 18%, transparent 19%),
    radial-gradient(ellipse at 72% 38%, rgba(128, 202, 88, .56) 0 22%, transparent 23%),
    linear-gradient(180deg, rgba(120, 200, 88, .58), rgba(79, 153, 61, .62));
  backdrop-filter: blur(1px);
}

.savanna-stage::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 0;
  height: 20%;
  background: repeating-linear-gradient(110deg, rgba(35, 94, 38, .2) 0 5px, transparent 6px 18px);
  opacity: .36;
}

.sun {
  display: none;
  position: absolute;
  right: 9%;
  top: 8%;
  width: 64px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff8be, #ffd84b 60%, #f4a629);
  box-shadow: 0 0 34px rgba(255, 214, 76, .72);
}

.cloud {
  display: none;
  position: absolute;
  width: 118px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  box-shadow: 28px -12px 0 5px rgba(255,255,255,.62), 58px 0 0 2px rgba(255,255,255,.5);
  animation: drift 10s ease-in-out infinite alternate;
}

.cloud-a { left: 8%; top: 13%; }
.cloud-b { left: 55%; top: 22%; transform: scale(.75); animation-duration: 12s; }

.gate {
  position: absolute;
  left: 4%;
  bottom: 12%;
  z-index: 4;
  width: 170px;
  height: 176px;
  display: block;
  color: #693713;
  font-weight: 950;
}

.gate::before,
.gate::after {
  display: none;
}

.gate img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  filter: drop-shadow(0 16px 18px rgba(44,25,9,.22));
}

.gate b {
  position: absolute;
  left: 34px;
  right: 34px;
  top: 28px;
  z-index: 2;
  height: 32px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 236, 160, .84);
  box-shadow: inset 0 2px rgba(255,255,255,.65);
}

.visitor-path {
  position: absolute;
  left: 4%;
  right: 10%;
  bottom: 12%;
  z-index: 2;
  height: 22%;
  border-radius: 50%;
  border-bottom: 34px solid rgba(216, 178, 112, .62);
  transform: rotate(-4deg);
}

.visitor-line {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.visitor-line i {
  position: absolute;
  left: 9%;
  bottom: 22%;
  width: 20px;
  height: 30px;
  border-radius: 10px 10px 7px 7px;
  background: var(--shirt);
  box-shadow: inset 0 7px #ffe2b7, 0 6px 10px rgba(0,0,0,.18);
  animation: visitor-walk 5.2s linear infinite;
  animation-delay: var(--delay);
}

.visitor-line i::before {
  content: "";
  position: absolute;
  left: 5px;
  top: -10px;
  width: 11px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f3ba7c;
}

.animal {
  position: absolute;
  z-index: 6;
  filter: drop-shadow(0 16px 16px rgba(37, 48, 26, .26));
  animation: animal-idle 2.8s ease-in-out infinite;
}

.animal::after {
  content: attr(data-name);
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,230,176,.92));
  box-shadow: 0 7px 14px rgba(62, 42, 18, .16);
  font-size: .72rem;
  font-weight: 950;
  white-space: nowrap;
}

.animal i {
  position: absolute;
  display: block;
}

.image-animal img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.lion {
  left: 22%;
  bottom: 17%;
  width: 250px;
  height: 235px;
}

.lion .body {
  left: 32px;
  bottom: 22px;
  width: 98px;
  height: 58px;
  border-radius: 48px 42px 34px 34px;
  background: linear-gradient(145deg, #f3b24c, #cf7534);
}

.lion .mane {
  left: 10px;
  top: 20px;
  width: 74px;
  height: 78px;
  border-radius: 46% 52% 45% 50%;
  background: radial-gradient(circle at 38% 35%, #d1782c, #8b431f 72%);
}

.lion .head {
  left: 25px;
  top: 36px;
  width: 46px;
  height: 44px;
  border-radius: 44% 44% 48% 48%;
  background: #f4b85c;
  box-shadow: inset 14px 0 rgba(255, 213, 127, .38);
}

.lion .head::before,
.lion .head::after {
  content: "";
  position: absolute;
  top: 15px;
  width: 6px;
  height: 7px;
  border-radius: 50%;
  background: #233022;
}

.lion .head::before { left: 14px; }
.lion .head::after { right: 12px; }

.lion .tail {
  right: 22px;
  bottom: 54px;
  width: 54px;
  height: 14px;
  border-radius: 999px;
  border-top: 8px solid #be6a32;
  transform: rotate(-20deg);
}

.lion .tail::after {
  content: "";
  position: absolute;
  right: -7px;
  top: -15px;
  width: 20px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #8b431f;
}

.lion .leg {
  bottom: 0;
  width: 18px;
  height: 38px;
  border-radius: 9px;
  background: #c96e34;
}

.lion .l1 { left: 58px; }
.lion .l2 { left: 106px; }

.giraffe {
  right: 12%;
  bottom: 13%;
  width: 230px;
  height: 360px;
  animation-delay: .4s;
}

.giraffe.locked {
  filter: grayscale(.8) opacity(.58);
}

.giraffe .body {
  left: 36px;
  bottom: 24px;
  width: 88px;
  height: 58px;
  border-radius: 42px 45px 30px 30px;
  background: radial-gradient(circle at 34% 24%, #ffe39b, transparent 28%), linear-gradient(145deg, #f6c96b, #d18a31);
  box-shadow: inset -10px -10px rgba(118,70,24,.14), 0 12px 18px rgba(48,34,15,.16);
}

.giraffe .neck {
  left: 74px;
  bottom: 70px;
  width: 30px;
  height: 92px;
  border-radius: 16px;
  background: linear-gradient(90deg, #d39137, #ffe19a);
  box-shadow: inset -8px 0 rgba(115,70,26,.12);
  transform: rotate(-8deg);
}

.giraffe .head {
  left: 65px;
  top: 20px;
  width: 58px;
  height: 40px;
  border-radius: 24px 28px 18px 20px;
  background: radial-gradient(circle at 34% 28%, #ffe8a8, #e3a845 76%);
  box-shadow: inset -8px -6px rgba(110,64,24,.12), 0 7px 10px rgba(54,35,14,.12);
}

.giraffe .head::before,
.giraffe .head::after {
  content: "";
  position: absolute;
  top: -13px;
  width: 8px;
  height: 20px;
  border-radius: 999px;
  background: #b66b2f;
}

.giraffe .head::before { left: 12px; }
.giraffe .head::after { right: 14px; }

.giraffe .spot {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b97842, #7e3e1d);
}

.giraffe .s1 {
  left: 58px;
  bottom: 52px;
  width: 16px;
  height: 14px;
}

.giraffe .s2 {
  left: 96px;
  bottom: 48px;
  width: 18px;
  height: 16px;
}

.giraffe .leg {
  bottom: 0;
  width: 16px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(180deg, #d58a3a, #8e4a20);
  box-shadow: inset -4px 0 rgba(68,38,16,.16);
}

.giraffe .l1 { left: 54px; }
.giraffe .l2 { left: 102px; }

.animal.fed {
  animation: animal-fed .5s cubic-bezier(.2, 1.5, .3, 1);
}

.heart-field {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.heart-field i {
  position: absolute;
  bottom: 52%;
  color: #ff477e;
  font-style: normal;
  font-weight: 950;
  animation: heart-pop .85s ease forwards;
}

.care-panel {
  display: grid;
  gap: 10px;
}

.happy-meter {
  position: relative;
  min-height: 48px;
  overflow: hidden;
  border-radius: 17px;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  background: rgba(255,255,255,.86);
  font-weight: 950;
}

.happy-meter i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #66ce5f, #ffd554);
  transition: width .25s ease;
}

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

.result-panel,
.loading-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(33, 55, 25, .38);
  backdrop-filter: blur(8px);
}

.result-card,
.loading-card {
  width: min(100%, 410px);
  border-radius: 26px;
  padding: 20px;
  display: grid;
  gap: 12px;
  text-align: center;
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 38px rgba(38,74,25,.24);
  font-weight: 950;
  animation: panel-in .24s ease both;
}

.report-score {
  width: 96px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fff6ad, #7fd873);
  font-size: 2rem;
  box-shadow: inset 0 -8px rgba(0,0,0,.09);
}

.skill-lines {
  display: grid;
  gap: 6px;
  text-align: left;
}

.skill-lines span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.skill-lines b {
  color: #ffae00;
}

.loading-card div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(45, 50, 29, .12);
}

.loading-card i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #62d878, #ffd45d);
  transition: width .2s ease;
}

.zoo-toast {
  position: fixed;
  left: 50%;
  top: 52%;
  z-index: 40;
  max-width: min(88vw, 420px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(35, 58, 25, .92);
  color: #fff9c7;
  font-weight: 950;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: toast-up 1.3s ease forwards;
}

@keyframes visitor-walk {
  from { transform: translateX(0) translateY(0); opacity: 0; }
  10% { opacity: 1; }
  55% { transform: translateX(310px) translateY(-20px); }
  90% { opacity: 1; }
  to { transform: translateX(520px) translateY(-28px); opacity: 0; }
}

@keyframes animal-idle {
  50% { transform: translateY(-4px); }
}

@keyframes animal-fed {
  45% { transform: translateY(-16px) scale(1.07); }
}

@keyframes heart-pop {
  to { opacity: 0; transform: translateY(-60px) scale(1.8); }
}

@keyframes drift {
  to { transform: translateX(32px); }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
}

@keyframes toast-up {
  to { opacity: 0; transform: translate(-50%, -145%); }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 42px 1fr;
  }

  .language-picker {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .resource-row {
    grid-template-columns: 1fr 1fr;
  }

  .resource-row .soft-btn {
    grid-column: 1 / -1;
  }

  .park-hud,
  .zoo-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .savanna-stage {
    min-height: 390px;
  }

  .lion {
    left: 18%;
    bottom: 18%;
    width: 148px;
    height: 138px;
    transform: none;
  }

  .giraffe {
    right: 3%;
    bottom: 15%;
    width: 126px;
    height: 206px;
    transform: none;
  }

  .gate {
    left: 3%;
    bottom: 13%;
    width: 104px;
    height: 110px;
  }

  .gate b {
    left: 20px;
    right: 20px;
    top: 17px;
    height: 22px;
    font-size: .72rem;
  }

  @keyframes visitor-walk {
    from { transform: translateX(0) translateY(0) scale(.88); opacity: 0; }
    10% { opacity: 1; }
    55% { transform: translateX(170px) translateY(-16px) scale(.88); }
    90% { opacity: 1; }
    to { transform: translateX(265px) translateY(-22px) scale(.88); opacity: 0; }
  }
}
