:root {
  color-scheme: light;
  font-family: "Arial Rounded MT Bold", "Noto Sans TC", system-ui, sans-serif;
  color: #2d2417;
  background: #e9c874;
  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: linear-gradient(180deg, #6ed5ff 0%, #e4fbff 35%, #78c25d 100%);
}

button,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.vine-app {
  width: min(100%, 980px);
  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: .68;
}

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

.icon-btn,
.soft-btn,
.menu-copy button,
.stage-card,
.result-card button,
.result-card a {
  min-height: 44px;
  border: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fff5bd 0%, #ffcb56 54%, #d98925 100%);
  color: #3b2815;
  box-shadow: inset 0 2px rgba(255,255,255,.7), 0 7px 0 #815024, 0 14px 24px rgba(55, 34, 12, .2);
  font-weight: 950;
  text-decoration: none;
}

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

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

.language-picker select {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 9px 10px;
  background: rgba(255,255,255,.92);
  color: #2d2417;
  font-weight: 950;
}

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

.cover {
  width: min(100%, 560px);
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 28px;
  object-fit: cover;
  box-shadow: 0 18px 38px rgba(41, 78, 28, .28);
}

.menu-copy,
.result-card {
  border-radius: 24px;
  padding: 16px;
  display: grid;
  gap: 12px;
  background: rgba(255, 247, 216, .94);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.6), 0 14px 28px rgba(54, 39, 19, .18);
  font-weight: 900;
}

.menu-copy strong {
  font-size: clamp(1.15rem, 5vw, 2rem);
}

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

.stage-card {
  min-height: 88px;
  padding: 10px;
  align-content: center;
  gap: 4px;
}

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

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

.hud-pill {
  min-height: 44px;
  border-radius: 16px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 8px 16px rgba(54, 39, 19, .16);
  font-weight: 950;
}

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

.playfield {
  position: relative;
  width: min(100%, 620px);
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 28px;
  background-image: linear-gradient(rgba(255,255,255,.06), rgba(48, 117, 43, .12)), url("../../assets/animal-vine-rescue-game-bg.webp");
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 5px rgba(255, 244, 180, .65), 0 18px 36px rgba(41, 78, 28, .26);
  touch-action: none;
}

.target-zone {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: 31%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  pointer-events: none;
}

#targetAnimal {
  width: 74%;
  max-width: 132px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(41, 31, 18, .22));
}

.basket {
  width: 100%;
  margin-top: -12%;
  object-fit: contain;
  filter: drop-shadow(0 8px 5px rgba(52, 30, 15, .22));
}

.vine-button {
  position: absolute;
  left: 50%;
  top: 0;
  width: clamp(82px, 18%, 120px);
  height: 45%;
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  padding: 0;
  display: grid;
  justify-items: center;
  cursor: pointer;
  z-index: 4;
  touch-action: manipulation;
}

.vine-button.cut {
  opacity: .18;
  pointer-events: none;
}

.vine-img {
  width: 62%;
  height: 100%;
  object-fit: fill;
  filter: drop-shadow(0 4px 3px rgba(20, 70, 24, .25));
}

.vine-button span {
  position: absolute;
  bottom: 4px;
  min-width: 44px;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 249, 210, .94);
  color: #2d6c27;
  font-size: .78rem;
  font-weight: 950;
  box-shadow: 0 4px 9px rgba(39, 76, 26, .18);
}

.fruit {
  position: absolute;
  width: 14%;
  max-width: 82px;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: drop-shadow(0 9px 5px rgba(48, 32, 15, .24));
  pointer-events: none;
  will-change: left, top, rotate;
}

.leaf-paddle {
  position: absolute;
  left: 50%;
  bottom: 17%;
  width: 34%;
  max-width: 190px;
  transform: translateX(-50%);
  object-fit: contain;
  filter: drop-shadow(0 8px 6px rgba(30, 70, 24, .24));
  pointer-events: none;
  will-change: left;
}

.float-text {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(47, 35, 18, .88);
  color: #fff3a7;
  font-weight: 950;
  pointer-events: none;
  animation: float-pop .9s ease forwards;
}

.toast {
  position: fixed;
  left: 50%;
  top: 46%;
  z-index: 30;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(47, 35, 18, .92);
  color: #fff3a7;
  font-weight: 950;
  box-shadow: 0 12px 24px rgba(33, 28, 16, .28);
  animation: float-pop 1.1s ease forwards;
  pointer-events: none;
}

.hint-text {
  margin: 0;
  text-align: center;
  font-weight: 950;
  color: #315528;
}

.result-panel,
.loading-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(35, 47, 24, .42);
  backdrop-filter: blur(8px);
}

.result-card,
.loading-card {
  width: min(100%, 360px);
  text-align: center;
}

.stars {
  color: #f4a51f;
  font-size: 2rem;
  letter-spacing: 0;
}

.loading-card {
  border-radius: 24px;
  padding: 18px;
  display: grid;
  gap: 12px;
  background: rgba(255, 249, 218, .96);
  font-weight: 950;
}

.loading-card div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(94, 74, 28, .18);
}

.loading-card i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #61d66f, #ffe36b);
}

@keyframes float-pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.85); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

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

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

  .stage-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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