/* 本页右侧目录：宽屏固定在右侧，窄屏隐藏 */
@media only screen and (max-width: 1199px) {
  .sidetoc {
    display: none !important;
  }
}

@media only screen and (min-width: 1200px) {
  /* 给正文留出右侧空间，避免与目录重叠 */
  #mdbook-content main,
  #content main,
  main {
    padding-right: 220px;
  }

  .sidetoc {
    position: fixed;
    top: calc(var(--menu-bar-height, 50px) + 12px);
    right: 12px;
    width: 200px;
    z-index: 5;
    pointer-events: none;
  }

  .pagetoc-title {
    pointer-events: auto;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--fg);
    opacity: 0.65;
    padding: 0 0 8px 10px;
  }

  .pagetoc {
    pointer-events: auto;
    width: 200px;
    max-height: calc(100vh - var(--menu-bar-height, 50px) - 48px);
    overflow: auto;
  }

  .pagetoc a {
    border-left: 1px solid var(--sidebar-bg);
    color: var(--fg) !important;
    display: block;
    padding: 5px 8px 5px 10px;
    text-align: left;
    text-decoration: none;
    font-size: 0.85em;
    line-height: 1.35;
  }

  .pagetoc a:hover,
  .pagetoc a.active {
    background: var(--sidebar-bg);
    color: var(--sidebar-active, #008cff) !important;
    border-left-color: var(--sidebar-active, #008cff);
  }

  .pagetoc .pagetoc-H2 {
    padding-left: 20px;
  }

  .pagetoc .pagetoc-H3 {
    padding-left: 40px;
  }

  .pagetoc .pagetoc-H4 {
    padding-left: 60px;
  }

  .pagetoc .pagetoc-H5,
  .pagetoc .pagetoc-H6 {
    display: none;
  }
}
