.inventory{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: grid;
  gap: 10px;
  justify-items: end;
  pointer-events: none;              /* so it never blocks dragging unless inside */
}
.inventory * { pointer-events: auto; }  /* re-enable for children */

.inv-toggle{
  font-family: "IM Fell English", serif;
  font-size: 14px;
  padding: .45rem .7rem;
  background:#fffdf6;
  border:2px solid #cbbca1;
  box-shadow:3px 3px 0 rgba(0,0,0,.35);
  transform: rotate(-.6deg);
  cursor:pointer;
}

.inv-grid{
  display: grid;
  width: auto;                 /* let slots define size */
  grid-template-columns: repeat(3, 88px);
  grid-auto-rows: 88px;        /* square slots */
  gap: 8px;
  padding: 10px;
  background:
    linear-gradient(rgba(255,255,255,.86), rgba(255,255,255,.86)),
    url('https://www.shutterstock.com/image-vector/seamless-pattern-thin-bow-knots-600nw-2562784749.jpg');
  background-size: 240px auto;
  border: 2px solid #c9b89f;
  box-shadow: 8px 10px 0 rgba(0,0,0,.45);
  transform: rotate(-.6deg);
}

.inventory.collapsed .inv-grid{ display:none; }
.inventory.collapsed .inv-toggle{ transform: rotate(-.6deg) translateY(0); }

.inv-slot{
  width: 88px;
  height: 88px;
  background:#fffef9;
  border:2px dashed #cbbca1;
  display:grid;
  place-items:center;
  position:relative;
}

/* The item wrapper should have a real box to constrain the icon */
.inv-item{
  width: 86%;
  height: 86%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.25));
  transition: transform .12s ease;
}
.inv-item:hover{ transform: translateY(-2px) rotate(-.4deg); }

/* Make the icon fit inside the wrapper box */
.inv-item img{
  width: 100%;
  height: 100%;
  object-fit: contain;   /* keeps proportions */
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* small label that appears on hover */
.inv-item .inv-label{
  position:absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.82);
  color:#ffd9e4;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
}
.inv-item:hover .inv-label{ opacity:1; visibility:visible; }
#backToHallway {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 10px 16px;
  font-family: "Garamond", serif;
  font-size: 16px;
  background: #fff8f9;
  border: 2px solid #d9b6d8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}