* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: #2d4a2b;
  font-family: system-ui, sans-serif;
  color: #fff;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#app { display: flex; flex-direction: column; height: 100dvh; }

#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: #1f3520;
}
#coinBox, #eggBox {
  display: flex; align-items: center; gap: 6px;
  background: #35513a; border-radius: 12px; padding: 4px 12px;
  font-size: 20px; font-weight: bold;
}
#eggIcon { width: 24px; height: 24px; image-rendering: pixelated; }
.barBtn {
  display: flex; align-items: center; gap: 6px;
  background: #b97e3f; border: none; border-radius: 12px;
  padding: 8px 14px; font-size: 17px; color: #fff; font-weight: bold;
}
.barBtn:active { transform: scale(0.95); }
#coinIcon, #basketIcon { width: 24px; height: 24px; image-rendering: pixelated; }

#stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#game { image-rendering: pixelated; background: #3d6134; }

#tools {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  padding: 8px; background: #1f3520; flex-wrap: wrap;
}
.toolBtn {
  position: relative;
  width: 56px; height: 56px; border-radius: 14px;
  border: 3px solid #35513a; background: #35513a;
  display: flex; align-items: center; justify-content: center;
}
.toolBtn canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.toolBtn.active { border-color: #ffd75e; background: #4a6b4f; }
.toolBtn:active { transform: scale(0.93); }
.toolBtn .badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 22px; height: 22px; border-radius: 11px;
  background: #ffd75e; color: #333; font-size: 14px; font-weight: bold;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.toolBtn .badge.zero { background: #777; color: #ccc; }

#tabs { display: flex; background: #16281a; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 4px; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: #9fbfa4; font-size: 20px; padding: 6px 0; border-radius: 10px;
}
.tab span { font-size: 12px; }
.tab.active { background: #35513a; color: #fff; }
.tab.locked { opacity: 0.35; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.overlay.hidden { display: none; }
.panel {
  background: #2b4030; border-radius: 18px; padding: 18px;
  width: min(92vw, 380px); max-height: 80dvh; overflow-y: auto;
}
.panel h2 { text-align: center; margin-bottom: 12px; font-size: 20px; }
.shopRow {
  display: flex; align-items: center; gap: 10px;
  background: #35513a; border-radius: 12px; padding: 10px; margin-bottom: 8px;
}
.shopRow canvas { width: 36px; height: 36px; image-rendering: pixelated; flex-shrink: 0; }
.shopRow .info { flex: 1; font-size: 15px; }
.shopRow .info .sub { font-size: 13px; color: #bcd8c0; }
.shopRow button {
  border: none; border-radius: 10px; padding: 10px 14px;
  font-size: 16px; font-weight: bold; color: #fff;
}
.shopRow button.buy { background: #4a8f4e; }
.shopRow button.sell { background: #b97e3f; }
.shopRow button:disabled { background: #555; color: #999; }
.shopRow button:active:not(:disabled) { transform: scale(0.95); }
.bigBtn {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: #4a6b4f; color: #fff; font-size: 17px; font-weight: bold;
}
.sectionTitle { font-size: 14px; color: #bcd8c0; margin: 10px 0 6px; }
#amTitle { display: flex; align-items: center; justify-content: center; gap: 8px; }
#amTitle canvas { image-rendering: pixelated; }
.hearts { display: flex; gap: 2px; }
.hearts canvas { image-rendering: pixelated; }
body.standMode #tools { display: none; }
