I'm not sure such question belongs on SO, before mods will chime in, welcome and have a couple of remarks:
This could save some duplicate positions. Instead of checkboxes and state tree, you can merge identical positions into single one and switch them like
<style>div:not(:target){display:none}</style>
<a href="#s00">start</a>
<div id="s00"><a href="#s01">1</a></div>