:root {
      /* Default Light Theme Variables */
      --bg-color: #fff;
      --text-color: #333;
      --header-bg: #f8f8f8;
      --border-color: #eee;
      --code-bg: #f0f0f0;
      --h1-color: #6c91c3;
      --h2-color: #7ba78b;
      --h3-color: #c39b6c;
      --link-color: #9b83c2;
      --sidebar-width: 250px;
      --sidebar-bg: #f4f4f4;
      --banner-height: 3.5em;
        /* Reduced height for the fixed banner */
    }

    body[data-theme="dark"] {
      --bg-color: #121212;
      --text-color: #eee;
      --header-bg: #1e1e1e;
      --border-color: #333;
      --code-bg: #282828;
      --h1-color: #a8c8f8;
      --h2-color: #a8f8c8;
      --h3-color: #f8c8a8;
      --link-color: #c8b3e8;
      --sidebar-bg: #282828;
      --text-color-invert: 1;
    }

    body {
      font-family: 'Roboto', sans-serif;
      line-height: 1.6;
      color: var(--text-color);
      background-color: var(--bg-color);
      margin: 0;
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }

    #banner {
      position: fixed; /* Make it fixed */
      top: 0; /* Stick to the top */
      width: 100%; /* Span full width */
      z-index: 100; /* Ensure it's above other content */
      padding: 0.5em 2em;
      background-color: var(--sidebar-bg);
      border-bottom: 1px solid var(--border-color);
      height: var(--banner-height); /* Explicit height */
      box-sizing: border-box; /* Include padding in height */
    }
    .banner-content {
      max-width: 800px;
      margin: 0 auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    #banner h1 {
      margin: 0;
      font-size: 1.5em;
        /* Match main h1 font size */
      border-bottom: none;
      color: var(--h1-color); /* Match main h1 color */
    }

    #main-layout {
      display: flex;
      flex-grow: 1;
      margin-top: var(--banner-height); /* Push content down below fixed banner */
    }

    #sidebar {
      position: fixed; /* Make it fixed */
      top: var(--banner-height); /* Start below the banner */
      bottom: 0; /* Extend to the bottom of the viewport */
      width: var(--sidebar-width);
      background-color: var(--sidebar-bg);
      padding: 2em 1em;
      border-right: 1px solid var(--border-color);
      border-top-right-radius: 10px;
      border-bottom-right-radius: 10px;
      overflow-y: auto;
      flex-shrink: 0;
      transition: transform 0.3s ease-in-out;
      height: calc(100vh - var(--banner-height)); /* Calculate height */
      z-index: 9999;
    }

    #sidebar.collapsed {
      width: 0;
      padding: 0;
      border-right: none;
      overflow: hidden;
    }

    #main-content {
      flex-grow: 1;
      padding: 2em;
      max-width: 800px;
      margin: 0 auto;
      transition: margin-left 0.3s ease-in-out;
    }

    #content {
      /* Original content styles, now applied within #main-content */
    }

    h1, h2, h3, h4, h5, h6 {
      font-family: 'Roboto Slab', serif;
      font-weight: 700;
      margin-top: 1.5em;
      margin-bottom: 0.5em;
    }
    h1 {
      font-size: 2.5em;
      border-bottom: 2px solid var(--border-color);
      padding-bottom: 0.3em;
      color: var(--h1-color);
    }
    h2 {
      font-size: 2em;
      border-bottom: 1px solid var(--border-color);
      padding-bottom: 0.3em;
      color: var(--h2-color);
    }
    h3 {
      font-size: 1.5em;
      color: var(--h3-color);
    }

    img {
      max-width: 100%;
      border-radius: 10px;
    }

    body[data-theme="dark"] img {
      filter: invert(0.9);
    }
    code {
      background-color: var(--code-bg);
      border-radius: 3px;
      font-family: 'Fira Code', monospace;
      color: var(--text-color);
    }
    pre {
      background-color: var(--code-bg);
      padding: 1em;
      border-radius: 5px;
      overflow-x: auto;
    }
    #content a {
      color: var(--link-color);
      text-decoration: none;
    }
    #content a:hover {
      text-decoration: underline;
    }

    /* TOC specific styles */
    .sidebar-top-buttons {
      display: flex;
      gap: 10px; /* Add a gap between the buttons */
      margin-bottom: 20px;
    }

    .sidebar-button {
      background: none;
      border: 1px solid #ccc;
      color: #333;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 5px;
      border-radius: 5px;
      height: 40px;
    }

    .sidebar-button:hover {
      background: #f0f0f0;
    }

    [data-theme="dark"] .sidebar-button {
      border-color: #555;
      color: #ccc;
    }

    [data-theme="dark"] .sidebar-button:hover {
      background: #333;
    }

    #theme-toggle.sidebar-button {
      width: 40px;
      padding: 0;
    }

    #language-toggle.sidebar-button {
      padding: 0 10px;
    }

    #language-toggle .active {
      font-weight: bold;
    }

    #theme-toggle img {
      width: 1.2em;
      height: 1.2em;
      filter: invert(var(--text-color-invert));
    }

    #table-of-contents ul {
      list-style: none;
      padding-left: 0;
    }

    #table-of-contents ul ul {
      padding-left: 1em;
    }

    #table-of-contents li {
      margin-bottom: 0.5em;
    }

    #table-of-contents a {
      display: block;
      color: var(--text-color);
      text-decoration: none;
    }

    #table-of-contents a:hover {
      color: var(--link-color);
      text-decoration: underline;
    }

    /* Sidebar toggle button */
    #sidebar-toggle, #home-button {
      background-color: var(--header-bg);
      border: 1px solid var(--border-color);
      color: var(--text-color);
      width: 2em;
      height: 2em;
      font-size: 1.2em;
      cursor: pointer;
      position: fixed;
      top: 0.5em;
      z-index: 1000;
      border-radius: 5px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    #sidebar-toggle {
      left: 0.5em;
    }

    #home-button {
      left: 3em;
    }

    /* Scrollbar styles for WebKit browsers */
    #sidebar::-webkit-scrollbar {
      width: 8px;
    }

    #sidebar::-webkit-scrollbar-track {
      background: transparent;
    }

    #sidebar::-webkit-scrollbar-thumb {
      background-color: rgba(0, 0, 0, 0.2); /* Translucent black */
      border-radius: 10px;
      border: 2px solid transparent; /* Creates a flat look */
      background-clip: padding-box; /* Ensures border doesn't cover thumb */
    }

    #sidebar::-webkit-scrollbar-thumb:hover {
      background-color: rgba(0, 0, 0, 0.3);
    }

    /* Scrollbar styles for Firefox (less customizable) */
    #sidebar {
      scrollbar-width: thin; /* "auto" or "thin" */
      scrollbar-color: rgba(0, 0, 0, 0.2) transparent; /* thumb and track color */
    }

    #star-buttons {
      position: fixed;
      top: 0.8em;
      right: 1em;
      z-index: 1000;
    }

    /* Table Styles */
    table {
      width: 100%;
      border-collapse: collapse;
      margin: 2em 0;
      box-shadow: 0 2px 15px rgba(0,0,0,0.1);
      border-radius: 10px;
      overflow: hidden;
    }

    th, td {
      padding: 12px 15px;
      text-align: left;
      border-bottom: 1px solid var(--border-color);
    }

    th {
      background-color: var(--sidebar-bg);
      font-weight: bold;
      color: var(--h2-color);
    }

    tr:last-child td {
      border-bottom: none;
    }

    tr:hover {
      background-color: var(--code-bg);
    }
