* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }

html, body { height: 100%; }

body {
  background: #1c1c2e;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: "Minecraft", "Monocraft", "Courier New", monospace;
}

#backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  image-rendering: pixelated;
  opacity: 0.35;
}

/* custom user backdrop (background.jpg/png/webp/gif) — replaces the dirt
   noise above when present, see loadCustomBackground() in gui.js */
#backdrop-img {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#gui-wrap {
  position: relative;
  filter: drop-shadow(0 14px 40px rgba(0,0,0,0.65));
}

#gui { image-rendering: pixelated; display: block; }

/* vanilla slot hover highlight (0x80FFFFFF over the 16x16 interior) */
.slot-hl {
  position: absolute;
  z-index: 3;
}
.slot-hl:hover {
  background: rgba(255, 255, 255, 0.5);
}

.item {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}
.item img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.item .count {
  position: absolute;
  right: 0;
  bottom: 0;
  line-height: 1;
  color: #fff;
}

/* an item picked up onto the cursor (moveable items) */
.item.held {
  position: fixed;
  z-index: 150;
  pointer-events: none;
}

/* ---- media gallery ---- */
#gallery {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: rgba(0, 0, 0, 0.82);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
}
#gallery.open { display: flex; }

#gallery .g-stage {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 92vw;
}

#gallery .g-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: 120px;
}

#gallery .g-media {
  display: block;
  max-width: 72vw;
  max-height: 68vh;
  background: #000;
  border: 3px solid;
  border-color: #555 #fff #fff #555;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
#gallery img.g-media.pixel { image-rendering: pixelated; }

#gallery .g-btn {
  width: 44px;
  height: 44px;
  flex: none;
  background: #c6c6c6;
  border: 3px solid;
  border-color: #fff #555 #555 #fff;
  color: #404040;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#gallery .g-btn:hover { background: #dadada; }
#gallery .g-btn:active { border-color: #555 #fff #fff #555; }

#gallery .g-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

#gallery .g-counter {
  color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
}

#gallery .g-thumbs {
  display: flex;
  gap: 8px;
  max-width: 92vw;
  overflow-x: auto;
  padding: 4px;
}

#gallery .g-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
  background: #000;
  border: 2px solid #555;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
}
#gallery .g-thumb:hover { opacity: 0.85; }
#gallery .g-thumb.active {
  opacity: 1;
  border-color: #fff;
}
#gallery .g-thumb img,
#gallery .g-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
#gallery .g-thumb .play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#gallery .g-thumb .play-icon::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

#gallery .g-empty {
  color: #aaa;
  text-shadow: 2px 2px 0 #222;
  padding: 30px;
}

/* Minecraft item tooltip */
#tooltip {
  position: fixed;
  display: none;
  z-index: 100;
  pointer-events: none;
  background: rgba(16, 0, 16, 0.94);
  border: 2px solid transparent;
  border-image: linear-gradient(rgba(80, 0, 255, 0.55), rgba(40, 0, 127, 0.55)) 1;
  box-shadow: 0 0 0 1px rgba(16, 0, 16, 0.94);
  white-space: normal;
}
