.chapter-nav:empty { display: none; }
.chapter-nav {
  --chapter-progress: 0%;
  position: fixed;
  z-index: 9;
  inset: calc(var(--header, 68px) + 12px) max(12px, env(safe-area-inset-right)) auto auto;
  display: flex;
  align-items: stretch;
  width: max-content;
  max-width: calc(100vw - 24px);
  border: 1px solid #565b49;
  color: var(--text, #f3f0e7);
  background: #111410f5;
  box-shadow: 0 8px 24px #090a0940;
  font: 750 12px/1.15 Manrope, Arial, sans-serif;
}
.chapter-nav::after {
  content: "";
  position: absolute;
  z-index: 1;
  pointer-events: none;
  bottom: -1px;
  left: -1px;
  width: var(--chapter-progress);
  height: 1px;
  background: var(--lime, #bcff35);
  transition: width .32s var(--ease, ease);
}
.chapter-nav-step,
.chapter-nav-current {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  transition: background .18s ease, color .18s ease;
}
.chapter-nav-step { width: 36px; flex-shrink: 0; color: var(--lime, #bcff35); }
.chapter-nav-step svg { width: 17px; height: 17px; }
.chapter-nav-prev svg { rotate: 180deg; }
.chapter-nav-step[aria-disabled] { color: #828575; cursor: default; }
.chapter-nav-step[href]:hover,
.chapter-nav-current:hover,
.chapter-nav-details[open] .chapter-nav-current { color: var(--lime, #bcff35); background: #242b1a; }
.chapter-nav-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  width: 132px;
  padding: 0 8px;
  border-inline: 1px solid #474c3a;
  cursor: pointer;
  list-style: none;
}
.chapter-nav-current::-webkit-details-marker { display: none; }
.chapter-nav-index,
.chapter-nav-list a > span { color: var(--lime, #bcff35); font: 700 10px/1 var(--mono, monospace); }
.chapter-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-nav-current > svg { width: 15px; height: 15px; color: #c2c4b5; }
.chapter-nav-list {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 6px) 0 auto auto;
  width: 100%;
  max-height: calc(100dvh - var(--header, 68px) - 65px);
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  border: 1px solid #565b49;
  background: #111410;
  list-style: none;
  box-shadow: 0 10px 30px #0008;
}
.chapter-nav-list a {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  transition: color .18s ease, background .18s ease;
}
.chapter-nav-list a:hover,
.chapter-nav-list a[aria-current="location"] { color: var(--lime, #bcff35); background: #242b1a; }
.chapter-nav a:focus-visible,
.chapter-nav summary:focus-visible { outline-offset: -2px; }

@media (max-width: 760px) {
  .chapter-nav { inset-block-start: calc(var(--header, 58px) + 8px); }
  .chapter-nav-step, .chapter-nav-current { min-height: 32px; }
  .chapter-nav-step { width: 32px; }
}
:root[data-motion="reduced"] .chapter-nav::after,
:root[data-motion="reduced"] :is(.chapter-nav-step, .chapter-nav-current, .chapter-nav-list a) { transition: none; }
