/* ---------- Page ---------- */
.back {
  position: absolute;
  top: 8px;
  left: 10px;
  color: #000000;
  font-size: 22px;
}

body {
  background-image: url("sprites/background.png");
  background-repeat: repeat;
  background-size: 320px 320px;    /* size of each tile on screen */
  image-rendering: pixelated;      /* keeps the pixel art crisp when scaled up */
}

/* ---------- Otto ---------- */
#npc {
  position: fixed;
  left: 50px;
  bottom: 50px;
  height: 160px;
  cursor: pointer;
  image-rendering: pixelated;
  z-index: 1000;
  touch-action: none;
}

/* ---------- Text box ---------- */
#npc-box {
  display: none;
  position: fixed;
  width: min(360px, calc(100vw - 40px));
  background: #f2e8cf;
  color: #1c1c28;
  border: 4px solid #1c1c28;
  box-shadow: 4px 4px 0 #1c1c28;
  padding: 10px 14px;
  font: 24px/1.15 "VT323", "Courier New", monospace;
  z-index: 1000;
}
#npc-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#npc-choices button {
  font: inherit;
  background: #1c1c28;
  color: #f2e8cf;
  border: none;
  padding: 2px 10px;
  cursor: pointer;
}
#npc-choices button:hover { background: #e0a526; color: #1c1c28; }

/* ---------- Apples ---------- */
#spawn-apple , #set-squirrel {
  position: fixed;
  top: 8px;
  right: 10px;
  z-index: 1500;
  font: 22px "VT323", "Courier New", monospace;
  background: #f2e8cf;
  color: #1c1c28;
  border: 4px solid #1c1c28;
  box-shadow: 4px 4px 0 #1c1c28;
  padding: 2px 12px;
  cursor: pointer;
}

#spawn-apple:hover, #set-squirrel:hover { background: #e0a526; }
#spawn-apple:active, #set-squirrel:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #1c1c28; }

.apple {
  position: fixed;
  width: 48px;
  image-rendering: pixelated;
  z-index: 500;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#apple-count {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  font: 26px "VT323", "Courier New", monospace;
  background: #f2e8cf;
  color: #1c1c28;
  border: 4px solid #1c1c28;
  box-shadow: 4px 4px 0 #1c1c28;
  padding: 2px 14px;
  pointer-events: none;
}

/* ---------- Shop ---------- */
#shop {
  position: fixed;
  left: 0;
  top: 60px;
  width: min(240px, calc(100vw - 60px));
  height: min(420px, calc(100vh - 280px));
  z-index: 1400;
  transition: transform 0.3s ease;
}
#shop.closed { transform: translateX(-100%); }

#shop-panel {
  height: 100%;
  background: #f2e8cf;
  color: #1c1c28;
  border: 4px solid #1c1c28;
  border-left: none;
  box-shadow: 4px 4px 0 #1c1c28;
  padding: 10px 14px;
  font: 24px/1.15 "VT323", "Courier New", monospace;
  overflow-y: auto;
}
#shop.closed #shop-panel { box-shadow: none; }   /* no shadow sliver at the screen edge */
#shop-panel h2 { margin: 0 0 8px; font: inherit; font-size: 32px; }

#shop-toggle {
  position: absolute;
  left: 100%;
  top: 12px;
  margin-left: -4px;
  font: 26px "VT323", "Courier New", monospace;
  background: #f2e8cf;
  color: #1c1c28;
  border: 4px solid #1c1c28;
  box-shadow: 4px 4px 0 #1c1c28;
  padding: 0 10px;
  cursor: pointer;
}
#shop-toggle:hover { background: #e0a526; }

/* ---------- Shop item + tree ---------- */
.shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font: inherit;
  text-align: left;
  background: #f2e8cf;
  color: #1c1c28;
  border: 3px solid #1c1c28;
  padding: 6px 8px;
  cursor: pointer;
}
.shop-item:hover:not(:disabled) { background: #e0a526; }
.shop-item:disabled { opacity: 0.55; cursor: not-allowed; }
.shop-item img { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; }
.shop-item small { display: block; font-size: 20px; }

#tree {
  position: fixed;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);   /* middle right of the screen */
  height: 320px;                 /* adjust to fit your sprite */
  image-rendering: pixelated;
  z-index: 400;                  /* below apples (500) and Otto (1000) */
  pointer-events: none;
}

/* ---------- Squirrel ---------- */
#set-squirrel { top: 56px; }                    /* sits under the Spawn apple button */

.shop-item + .shop-item { margin-top: 8px; }

#squirrel {
  position: fixed;
  height: 96px;                                 /* adjust to your sprite (3x if it's 32px) */
  image-rendering: pixelated;
  z-index: 600;
  cursor: pointer;
  transform: translate(-50%, -50%);
}
.apple.carried { z-index: 700; pointer-events: none; }

#stash-x {
  position: fixed;
  width: 48px;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  z-index: 300;
  pointer-events: none;
}

#place-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  cursor: crosshair;
  background: rgba(26, 26, 46, 0.15);
}
#place-overlay span {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  font: 26px "VT323", "Courier New", monospace;
  background: #f2e8cf;
  color: #1c1c28;
  border: 4px solid #1c1c28;
  box-shadow: 4px 4px 0 #1c1c28;
  padding: 2px 14px;
  pointer-events: none;
}