This is a cheeky answer, but if you are constrained to CSS only and able to reverse your items in the DOM, it might be worth considering. It relies on the fact that while there is no selector for the last element of a specific class, it is actually possible to style the first. The trick is to then use flexbox to display the elements in reverse order.
ul {_x000D_
display: flex;_x000D_
flex-direction: column-reverse;_x000D_
}_x000D_
_x000D_
/* Apply desired style to all matching elements. */_x000D_
ul > li.list {_x000D_
background-color: #888;_x000D_
}_x000D_
_x000D_
/* Using a more specific selector, "unstyle" elements which are not the first. */_x000D_
ul > li.list ~ li.list {_x000D_
background-color: inherit;_x000D_
}
_x000D_
<ul>_x000D_
<li class="list">0</li>_x000D_
<li>1</li>_x000D_
<li class="list">2</li>_x000D_
</ul>_x000D_
<ul>_x000D_
<li>0</li>_x000D_
<li class="list">1</li>_x000D_
<li class="list">2</li>_x000D_
<li>3</li>_x000D_
</ul>
_x000D_