.chapter-order-nav {
  position: relative;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(1120px, calc(100% - 24px));
  margin: 18px auto 26px;
  max-height: 60rem;
  opacity: 1;
  overflow: hidden;
  visibility: visible;
  transition: max-height .38s ease, opacity .24s ease, margin .38s ease, visibility 0s linear 0s;
}

body .chapter-order-toggle {
  position: relative;
  z-index: 7;
  display: inline-flex!important;
  align-items: center!important;
  justify-content: center!important;
  gap: 9px!important;
  width: auto!important;
  min-height: 44px!important;
  margin: 10px auto 4px!important;
  padding: 10px 20px!important;
  border: 1px solid rgba(255, 248, 226, .78)!important;
  border-radius: 999px!important;
  background: linear-gradient(135deg, rgba(255, 252, 244, .96), rgba(244, 226, 205, .94))!important;
  box-shadow: 0 10px 28px rgba(35, 23, 22, .24), inset 0 1px 0 rgba(255, 255, 255, .82)!important;
  color: #4b3028!important;
  font: 750 13px/1 Inter, Arial, sans-serif!important;
  letter-spacing: .035em!important;
  cursor: pointer!important;
  appearance:none!important;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease!important;
}

body .chapter-order-toggle:hover,
body .chapter-order-toggle:focus-visible {
  background: linear-gradient(135deg, #fffdf7, #f6e8d6)!important;
  box-shadow: 0 13px 32px rgba(35, 23, 22, .3), 0 0 0 3px rgba(255, 249, 230, .34)!important;
  outline: none!important;
  transform: translateY(-1px)!important;
}

.chapter-order-toggle__caret {
  display: inline-block;
  font-size: 15px;
  transition: transform .28s ease;
}

.chapter-order-toggle.is-expanded .chapter-order-toggle__caret {
  transform: rotate(180deg);
}

.chapter-order-nav.is-collapsed {
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: max-height .38s ease, opacity .2s ease, margin .38s ease, visibility 0s linear .38s;
}

.world-browser > .chapter-order-toggle,
.page-heading > .chapter-order-toggle {
  display: flex!important;
  width: max-content!important;
}

.world-create main > .chapter-order-toggle {
  display: flex!important;
  width: max-content!important;
}

.chapter-order-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid rgba(72, 47, 35, .34);
  border-radius: 999px;
  background: rgba(255, 250, 236, .94);
  box-shadow: 0 5px 16px rgba(28, 20, 17, .18);
  color: #422b21;
  font: 700 12px/1.15 Inter, Arial, sans-serif;
  text-align: center;
  text-decoration: none;
  transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.chapter-order-nav__link:hover,
.chapter-order-nav__link:focus-visible {
  background: #fff9e8;
  box-shadow: 0 7px 20px rgba(28, 20, 17, .24);
  outline: none;
  transform: translateY(-1px);
}

.chapter-order-nav__link[aria-current="page"] {
  border-color: #3c261d;
  background: #4a3025;
  color: #fff9e8;
  box-shadow: 0 7px 20px rgba(28, 20, 17, .3);
}

.world-browser > .chapter-order-nav {
  width: 100%;
  margin-top: 2px;
}

.page-heading > .chapter-order-nav {
  width: min(980px, 100%);
  margin-top: 12px;
  margin-bottom: 0;
}

.page-heading > .chapter-order-toggle { margin-top: 12px !important; }

.world-create main > .chapter-order-nav {
  margin-top: 1.25rem;
}

@media (max-width: 560px) {
  body .chapter-order-toggle {
    width: min(100% - 24px, 330px)!important;
    margin-top: 12px!important;
  }

  .chapter-order-nav {
    gap: 6px;
    width: min(100% - 12px, 1120px);
  }

  .chapter-order-nav__link {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chapter-order-nav,
  .chapter-order-nav.is-collapsed,
  .chapter-order-toggle,
  .chapter-order-toggle__caret {
    transition: none;
  }
}
