html {
    scroll-behavior: smooth;
  }

  /* Add new styles for the navigation */
  .toc-wrapper {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 250px;
    max-width: 40vw;
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1100 !important;
    margin-top: 12px;
  }

  .toc-list {
    list-style-type: none;
    padding-left: 0;
  }

  .toc-list li {
    margin: 8px 0;
  }

  .toc-list a {
    color: #4a4a4a;
    text-decoration: none;
    font-size: 0.9em;
  }

  .toc-list a:hover {
    color: #3273dc;
  }

  .toc-list .toc-subitem {
    padding-left: 15px;
    font-size: 0.85em;
  }

  /* Hide TOC only for medium screens (769px-1200px), not for mobile */
  @media screen and (max-width: 1200px) and (min-width: 769px) {
    .toc-wrapper {
      width: 160px !important;
      max-width: 35vw !important;
      padding: 8px !important;
    }
    .toc-list a {
      font-size: 0.85em !important;
      padding: 4px 6px !important;
    }
  }

  /* Responsive TOC for small screens */
  @media screen and (max-width: 768px) {
    .toc-wrapper {
      position: static !important;
      width: 100vw !important;
      max-width: 100vw !important;
      top: unset !important;
      right: unset !important;
      left: 0 !important;
      border-radius: 0 !important;
      box-shadow: none !important;
      background: #fff;
      z-index: 1100 !important;
      padding: 4px 0 4px 0 !important;
      margin: 0 !important;
      overflow-x: auto !important;
      overflow-y: hidden !important;
      white-space: nowrap !important;
      border-bottom: 1px solid #eee;
    }
    .toc-list {
      display: flex !important;
      flex-direction: row !important;
      justify-content: flex-start;
      align-items: center;
      gap: 6px;
      width: max-content;
      margin: 0;
      padding: 0 6px;
      overflow-x: auto;
      overflow-y: hidden;
    }
    .toc-list li {
      margin: 0 4px 0 0 !important;
      display: inline-block !important;
    }
    .toc-list a {
      font-size: 0.85em !important;
      padding: 4px 6px !important;
      border-radius: 4px;
      background: #f7f7f7;
      border: 1px solid #eee;
      display: inline-block;
    }
    .toc-list a:hover {
      background: #e0e7ff;
      color: #2A75D0;
    }
    .toc-wrapper h4 {
      display: none;
    }
  }

  #hide-toc-btn {
    background: #eee;
    color: #333;
    border: none;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 0.9em;
    cursor: pointer;
    margin-bottom: 6px;
  }

  #hide-toc-btn:hover {
    background: #e0e7ff;
    color: #2A75D0;
  }

  #show-toc-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
    padding: 6px 14px;
    font-size: 1em;
    background: #2A75D0;
    color: white;
    border: none;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    display: none;
  }

  #show-toc-btn:hover {
    background: #174a8c;
  }