/* One sidebar, one toggle: icons and the pointer target keep their position. */
.shell.reference-sidebar-shell {
  --reference-rail-width: clamp(56px, 3.78vw, 104px);
  --reference-sidebar-width: clamp(238px, 18vw, 330px);
  --reference-sidebar-top: clamp(80px, 5.45vw, 150px);
  --reference-nav-height: clamp(44px, 2.76vw, 76px);
  --reference-nav-gap: clamp(12px, .8vw, 22px);
  --reference-icon-size: clamp(24px, 1.38vw, 38px);
  --reference-sidebar-text: #231b35;
  --reference-sidebar-muted: #766b84;
  --reference-sidebar-line: rgba(124, 99, 145, .23);
  --reference-sidebar-raised: rgba(123, 95, 149, .1);
  --reference-sidebar-surface: #faf8fc;
  --navigation-width: var(--reference-rail-width);
}
html[data-theme="dark"] .shell.reference-sidebar-shell,
.dark .shell.reference-sidebar-shell {
  --reference-sidebar-text: #f4f0f8;
  --reference-sidebar-muted: #9e94ae;
  --reference-sidebar-line: rgba(188, 167, 210, .24);
  --reference-sidebar-raised: rgba(190, 157, 215, .14);
  --reference-sidebar-surface: #0e0b18;
}
.shell.reference-sidebar-shell .sidebar {
  inset: var(--reference-sidebar-top) auto 0 0;
  display: flex;
  align-items: stretch;
  width: var(--navigation-width);
  padding: 16px 0;
  border-right: 1px solid var(--reference-sidebar-line);
  color: var(--reference-sidebar-muted);
  background: var(--reference-sidebar-surface);
  box-shadow: none;
  backdrop-filter: none;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
.shell.reference-sidebar-shell .sidebar-heading {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 40px;
  width: 100%;
  height: 40px;
  min-height: 40px;
  margin: 0 0 20px;
  padding: 0;
}
.shell.reference-sidebar-shell .desktop-sidebar-toggle {
  position: absolute;
  inset: 0 auto auto calc((var(--reference-rail-width) - 40px) / 2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 9px;
  border: 1px solid var(--reference-sidebar-line);
  border-radius: 11px;
  color: var(--reference-sidebar-muted);
  background: transparent;
  box-shadow: none;
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
.shell.reference-sidebar-shell .desktop-sidebar-toggle:hover {
  color: #cd76d6;
  background: var(--reference-sidebar-raised);
}
.shell.reference-sidebar-shell .desktop-sidebar-toggle .icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
}
.sidebar-toggle-direction { transform-origin: 14.5px 12px; }
[aria-expanded="true"] > .icon .sidebar-toggle-direction { transform: rotate(180deg); }
.shell.reference-sidebar-shell .sidebar .brand {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin-left: var(--reference-rail-width);
  margin-right: 12px;
  padding: 0;
  gap: 8px;
  color: var(--reference-sidebar-text);
}
.shell.reference-sidebar-shell .sidebar .brand-mark {
  flex: none;
  width: 28px;
  height: 30px;
  border: 1px solid var(--reference-sidebar-line);
  border-radius: 9px;
  color: #cd76d6;
  background: var(--reference-sidebar-raised);
}
.shell.reference-sidebar-shell .sidebar .brand-mark .icon { width: 21px; height: 21px; }
.shell.reference-sidebar-shell .sidebar .brand-title {
  font: 600 16px/1.4 "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
  color: var(--reference-sidebar-text);
}
.shell.reference-sidebar-shell .sidebar .new-story {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: none;
  width: calc(100% - 16px);
  min-height: 44px;
  height: 44px;
  margin: 0 8px 20px;
  padding: 0 calc((var(--reference-rail-width) - 16px - var(--reference-icon-size)) / 2);
  gap: 12px;
  border: 1px solid var(--reference-sidebar-line);
  border-radius: 12px;
  color: var(--reference-sidebar-text);
  background: var(--reference-sidebar-raised);
  transition: color .18s, background-color .18s, border-color .18s;
}
.shell.reference-sidebar-shell .sidebar .new-story .icon {
  flex: none;
  width: var(--reference-icon-size);
  height: var(--reference-icon-size);
}
.shell.reference-sidebar-shell .sidebar .nav {
  flex: none;
  align-items: stretch;
  width: 100%;
  gap: var(--reference-nav-gap);
}
.shell.reference-sidebar-shell .sidebar .nav a,
.shell.reference-sidebar-shell .homepage-rail-settings > summary {
  position: relative;
  inset: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: none;
  min-width: 0;
  min-height: var(--reference-nav-height);
  height: var(--reference-nav-height);
  margin: 0 8px;
  padding: 0 calc((var(--reference-rail-width) - 16px - var(--reference-icon-size)) / 2);
  gap: 12px;
  border: 0;
  border-radius: clamp(9px, .6vw, 17px);
  color: var(--reference-sidebar-muted);
  background: transparent;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: none;
  transition: color .18s, background-color .18s;
}
.shell.reference-sidebar-shell .sidebar .nav .icon,
.shell.reference-sidebar-shell .homepage-rail-settings > summary > .icon {
  flex: none;
  width: var(--reference-icon-size);
  height: var(--reference-icon-size);
  stroke-width: 1.4;
}
.shell.reference-sidebar-shell .sidebar .nav a.active,
.shell.reference-sidebar-shell .sidebar .nav a:hover,
.shell.reference-sidebar-shell .homepage-rail-settings > summary:hover {
  color: #cd76d6;
  background: var(--reference-sidebar-raised);
}
.shell.reference-sidebar-shell .sidebar .nav a.active::before { content: none; }
.shell.reference-sidebar-shell .sidebar-label {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 14px 18px 10px;
  color: var(--reference-sidebar-muted);
  font-size: 12px;
  letter-spacing: 0;
}
.shell.reference-sidebar-shell .sidebar-label > span { margin-left: auto; }
.shell.reference-sidebar-shell .sidebar-label > a { width: 24px; height: 24px; color: inherit; }
.shell.reference-sidebar-shell .sidebar-label > a .icon { width: 18px; height: 18px; }
.shell.reference-sidebar-shell .recent-list { flex: 1; min-height: 0; margin: 0 8px; overflow-y: auto; }
.shell.reference-sidebar-shell .sidebar .recent-item { min-height: 42px; border-radius: 10px; }
.shell.reference-sidebar-shell .sidebar .recent-item .recent-link {
  min-height: 42px;
  padding: 10px;
  font-size: 13px;
  color: var(--reference-sidebar-muted);
}
.shell.reference-sidebar-shell .recent-empty { padding: 12px 10px; font-size: 12px; color: var(--reference-sidebar-muted); }
.shell.reference-sidebar-shell .sidebar-bottom {
  width: auto;
  margin: auto 12px 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--reference-sidebar-line);
}
.shell.reference-sidebar-shell .sidebar-bottom > .row { gap: 10px; }
.shell.reference-sidebar-shell .sidebar-bottom .avatar { width: 34px; height: 34px; border-radius: 50%; }
.shell.reference-sidebar-shell .sidebar-bottom .user-info strong { color: var(--reference-sidebar-text); font-size: 13px; }
.shell.reference-sidebar-shell .sidebar-bottom .user-info small { color: var(--reference-sidebar-muted); font-size: 11px; }
.shell.reference-sidebar-shell .sidebar-bottom .icon-button { width: 30px; height: 32px; min-height: 0; padding: 6px; color: var(--reference-sidebar-muted); }
.shell.reference-sidebar-shell .sidebar-bottom .icon-button .icon { width: 18px; height: 18px; }
.shell.reference-sidebar-shell .homepage-settings-panel {
  z-index: 50;
  color: var(--reference-sidebar-text);
  border-color: var(--reference-sidebar-line);
}
.shell.reference-sidebar-shell .homepage-settings-panel a { min-height: 36px; margin: 0; padding: 8px; font-size: 13px; }
.shell.reference-sidebar-shell .homepage-settings-panel a .icon { width: 19px; height: 19px; }
.shell.reference-sidebar-shell .homepage-rail-settings:not([open]) > .homepage-settings-panel { display: none; }
.shell.reference-sidebar-shell .homepage-rail-settings > summary { list-style: none; cursor: pointer; }
.shell.reference-sidebar-shell .homepage-rail-settings > summary::-webkit-details-marker { display: none; }
.shell.reference-sidebar-shell .homepage-rail-settings > summary::marker { content: ""; }
.shell.reference-sidebar-shell .sidebar :is(a,button,summary):focus-visible { outline: 2px solid #cf75da; outline-offset: -2px; }
@media (min-width: 761px) {
  .shell.reference-sidebar-shell .topbar [data-action="sidebar-toggle"] { display: none; }
  .shell.reference-sidebar-shell:not(.sidebar-collapsed) { --navigation-width: var(--reference-sidebar-width); }
  .shell.reference-sidebar-shell.sidebar-collapsed { --navigation-width: var(--reference-rail-width); }
  .shell.reference-sidebar-shell.sidebar-collapsed .sidebar { align-items: stretch; }
  .shell.reference-sidebar-shell.sidebar-collapsed .sidebar .brand,
  .shell.reference-sidebar-shell.sidebar-collapsed .sidebar .nav-label,
  .shell.reference-sidebar-shell.sidebar-collapsed .sidebar-label,
  .shell.reference-sidebar-shell.sidebar-collapsed .recent-list,
  .shell.reference-sidebar-shell.sidebar-collapsed .sidebar-bottom { display: none; }
  .shell.reference-sidebar-shell .sidebar .homepage-rail-shortcut { display: flex; }
  .shell.reference-sidebar-shell .sidebar .homepage-rail-settings { margin-bottom: 12px; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .shell.reference-sidebar-shell { --reference-sidebar-top: 128px; }
}
@media (max-height: 850px) and (min-width: 761px) {
  .shell.reference-sidebar-shell { --reference-nav-gap: 6px; --reference-nav-height: 44px; }
  .shell.reference-sidebar-shell .sidebar-heading { margin-bottom: 12px; }
  .shell.reference-sidebar-shell .sidebar .new-story { margin-bottom: 12px; }
}
@media (max-width: 760px) {
  .shell.reference-sidebar-shell { --navigation-width: 0px; --reference-sidebar-top: var(--home-header-height, var(--library-header-height, var(--mobile-sidebar-top, 62px))); --reference-nav-height: 42px; --reference-nav-gap: 5px; --reference-icon-size: 22px; }
  .shell.reference-sidebar-shell .sidebar {
    z-index: 44;
    width: min(280px, 88vw);
    padding: 18px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-102%);
  }
  .shell.reference-sidebar-shell .sidebar.open { transform: translateX(0); }
  .shell.reference-sidebar-shell .desktop-sidebar-toggle { display: none; }
  .shell.reference-sidebar-shell .sidebar .brand { margin-left: 18px; }
  .shell.reference-sidebar-shell .sidebar .brand-title { font-size: 18px; }
  .shell.reference-sidebar-shell .sidebar-heading { margin-bottom: 16px; }
  .shell.reference-sidebar-shell .sidebar-bottom { margin-top: auto; }
  .shell.reference-sidebar-shell .mobile-dimmer { top: var(--reference-sidebar-top); z-index: 43; }
  .shell.reference-sidebar-shell .homepage-settings-panel { top: auto; bottom: 0; left: 12px; }
}
