.has-story-nav { --story-rail: 218px; }
.has-story-nav:has(.story-menu:not([open])) { --story-rail: 86px; }
.story-sidebar {
  position: fixed; z-index: 10; inset: 18px auto 18px 18px; width: calc(var(--story-rail) - 18px);
  display: flex; flex-direction: column; overflow: auto; gap: 1.1rem; padding: 24px 14px 14px;
  border: 1px solid #49394f; border-radius: 19px; background: #49394f; color: #fff6f4;
}
.has-story-nav { padding-inline-start: var(--story-rail); }
.story-brand {
  display: flex; align-items: center; justify-content: flex-start; gap: .5rem; white-space: nowrap; padding-inline: .5rem;
  font-family: 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif; font-size: 1.32rem; font-weight: 700;
  color: #fff6f4; text-decoration: none;
}
.story-menu > summary {
  display: flex; align-items: center; justify-content: space-between; gap: .35rem;
  padding: .50rem .55rem; border: 1px solid #ffffff36; border-radius: 9px; cursor: pointer;
  list-style: none; font-size: .85rem; color: #f5e8f0; white-space: nowrap;
}
.story-menu summary::-webkit-details-marker { display: none; }
.story-menu summary::after { content: '›'; font-size: 1rem; }
.story-menu[open] > summary::after, .story-community[open] > summary::after { transform: rotate(90deg); }
.story-menu nav { display: grid; gap: .30rem; margin: .75rem 0 1rem; }
.story-menu nav a, .story-community > summary {
  display: flex; align-items: center; gap: .60rem; padding: .65rem .55rem;
  color: #f6ebf2; text-decoration: none; border-radius: 7px; font-size: .93rem;
}
@media (prefers-reduced-motion: no-preference) {
  .story-menu summary::after { transition: transform 160ms ease; }
  .story-menu[open] nav { animation: story-menu-arrive 170ms ease-out both; }
}
@keyframes story-menu-arrive {
  from { opacity: .15; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}
.story-nav-icon { display: grid; place-items: center; flex: 0 0 1.2rem; color: #e4c591; font-variant-emoji: text; }
.story-community > summary { cursor: pointer; list-style: none; }
.story-community > summary::after { margin-inline-start: auto; }
.story-community-links { margin: .12rem 0 .25rem 1.1rem; padding-inline-start: .4rem; border-inline-start: 1px solid #edcfe14d; }
.story-menu nav .story-community-links a { padding-block: .48rem; font-size: .86rem; }
.story-menu nav a[aria-current], .story-menu nav a:hover, .story-community > summary:hover,
.story-community.is-current > summary { background: #fff0f21e; color: #fff5e0; }
.story-studio {
  display: block; border-top: 1px solid #ffffff38; padding: 1rem .6rem; color: #f6ebf2;
  text-decoration: none; font-size: .86rem;
}
.story-sidebar :focus-visible { outline: 2px solid #efcf9c; outline-offset: 3px; }
@media (min-width: 901px) {
  .story-sidebar:has(.story-menu:not([open])) { padding: 16px 7px; }
  .story-sidebar:has(.story-menu:not([open])) .story-brand span { display: none; }
}
@media (max-width: 900px) {
  .has-story-nav { padding-inline-start: 0; }
  .story-brand { padding: 0; }
  .story-sidebar {
    position: relative; inset: auto; width: auto; display: flex; flex-direction: row;
    justify-content: space-between; align-items: center; overflow: visible; padding: .65rem .85rem;
    margin: 12px 12px 0; border-radius: 16px;
  }
  .story-menu[open] nav {
    position: absolute; right: .55rem; z-index: 1; top: calc(100% - 3px); width: min(250px, calc(100vw - 34px)); gap: .15rem;
    margin: 0; padding: .6rem; border: 1px solid #695571; border-radius: 14px;
    background: #49394f; box-shadow: 0 16px 32px #614b6d29;
    max-height: calc(100dvh - 85px); overflow: auto;
  }
  .story-menu nav a, .story-community > summary { padding: .55rem .6rem; }
}
