
      :root {
        --bg-color: #0a0a15;
        --editor-bg: #151c41ca;
        --sidebar-bg: #151c41;
        --primary-text: #e0e0e0;
        --secondary-text: #aaaaaa;
        --border-color: #3a3a4a;
        --accent-color: #4a00e0;
        --hover-bg: #e7e7e72f;
        --drop-target-bg: #3a3a5a;
        --font-main: 'Inter', sans-serif;
        --font-mono: 'Fira Code', monospace;
        --hover-primary: rgb(118, 252, 234);
        --drag-shadow: rgba(118, 252, 234, 0.35);
      }

      body.theme-bright {
        --bg-color: #f4f4f6;
        --editor-bg: #ffffff;
        --sidebar-bg: #f7f6f6;
        --primary-text: #0d0d0d;
        --secondary-text: #555555;
        --border-color: #d9d9e3;
        --accent-color: #e81a96;
        --hover-bg: #e9eef6;
        --drop-target-bg: rgba(26, 115, 232, 0.12);
        --hover-primary: #e81a96;
        --drag-shadow: rgba(26, 115, 232, 0.28);
      }

      body,
      html {
        margin: 0;
        padding: 0;
        height: 100%;
        width: 100%;
        overflow: hidden;
        font-family: var(--font-mono);
        background-color: var(--bg-color);
        color: var(--primary-text);
        box-sizing: border-box;
        overscroll-behavior: contain;
        font-size: 16px !important;
      }
      input,
      textarea,
      select,
      button {
        font-size: 16px !important;
      }

      textarea {
        background: unset;
        color: unset;
        border: 1px solid;
        height: 100%;
        resize:none;
        overflow-y: auto;
        outline: none;
        padding: 1rem;
      }
      body {
        scrollbar-width: thin;
        scrollbar-color: var(--drop-target-bg) var(--bg-color);
      }

      body::-webkit-scrollbar {
        width: 12px;
      }

      body::-webkit-scrollbar-track {
        border-radius: 0px;
      }

      body::-webkit-scrollbar-thumb {
        border-radius: 0px;
      }

      #app-container {
        position: relative; /* Create a stacking context */
        display: flex;
        height: 100vh;
      }

      #hamburger {
        position: absolute;
        margin: 1rem 1rem;
        width: 32px;
        height: 33px !important;
        z-index: 102; /* Above sidebar */
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
        -webkit-transition: .5s ease-in-out;
        transition: .5s ease-in-out;
        cursor: pointer;
        padding: 0;
      }

      #hamburger span {
        display: inline-block;
        position: absolute;
        left: 0;
        height: 2px;
        width: 100%;
        background: var(--primary-text);
        border-radius: 5px;
        opacity: 1;
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
        -webkit-transition: .25s ease-in-out;
        transition: .25s ease-in-out;
      }
      #hamburger:hover span {
        background-color: var(--hover-primary);
      }
      #hamburger span:nth-child(1) { top: 0px; }
      #hamburger span:nth-child(2) { top: 14px; }
      #hamburger span:nth-child(3) { top: 28px; }
      #hamburger.open span:nth-child(1) { top: 9px; -webkit-transform: rotate(135deg); transform: rotate(135deg); }
      #hamburger.open span:nth-child(2) { top: 9px; opacity: 0; left: -60px; }
      #hamburger.open span:nth-child(3) { top: 9px; -webkit-transform: rotate(-135deg); transform: rotate(-135deg); }

      #sidebar {
        position: absolute;
        height: 100%;
        width: 280px;
        background-color: var(--sidebar-bg);
        border-right: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        overflow-y: hidden;
        transition: ease 0.22s;
        flex-shrink: 0;
        z-index: 101; /* Above graph, below modals */
        transform: translateX(0); /* Promotes to a layer for consistent stacking */
      }
      .sidebar-header {
        position: relative;
        border-bottom: 1px solid var(--border-color);
        box-sizing: border-box;
        width: 100%;
        height: 3.75rem;
      }
      #sidebar.closed {
        transform: translateX(-280px);
      }
      #free-look-toggle {
        position: absolute;
        right: 120px;
        top: 14px;
        width: 36px;
        height: 36px;
        padding: 3px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 3px solid var(--primary-text);
        border-radius: 32px;
        color: var(--primary-text);
        cursor: pointer;
        transition: all 0.2s ease;
        z-index: 100;
        box-shadow: none;
      }
      #free-look-toggle span {
        display: inline-block;
        background-color: var(--primary-text);
        width: 30%;
        height: 30%;
        border-radius: 32px;
        transition: all 0.2s ease;
      }
      #free-look-toggle:hover,
      #free-look-toggle:focus-visible {
        border-color: var(--hover-primary);
        color: var(--hover-primary);
        outline: none;
        box-shadow: 0 0 0 2px var(--hover-primary);
      }
      #free-look-toggle.active {
        border-color: var(--hover-primary);
        color: var(--hover-primary);
      }
      #free-look-toggle:hover span,
      #free-look-toggle.active span {
        transition: all 0.2s ease;
        background-color: transparent;
      }
      #free-look-toggle .free-look-line {
        position: absolute;
        background-color: currentColor;
        border-radius: 2px;
        transition: background-color 0.2s ease;
      }
      #new-note-btn {
        position: absolute;
        right: 76px;
        top: 0.75rem;
        width: 28px;
        z-index: 100;
        height: 36px;
        color: var(--primary-text);
        float: right;
        /* margin-right: 0.5rem; */
        /* margin-top: 0.5rem; */
        background: transparent;
        font-family: var(--font-mono);
        /* border: 1px solid var(--primary-text); */
        /* padding: 8px 12px; */
        border-radius: 5px;
        cursor: pointer;
        transition: all 0.2s ease;
      }
      #new-note-btn:hover {
        color: var(--hover-primary);
        border-color: var(--hover-primary);
      }
      #new-note-btn span {
        display: inline-block;
        position: absolute;
        top: 18px;
        background-color: var(--primary-text);
        height: 3px;
        width: 28px;
      }
      #new-note-btn:hover span {
        background-color: var(--hover-primary);
      }
      #new-note-btn span:nth-child(1) {
        -webkit-transform: rotate(90deg); transform: rotate(90deg);
      }
      #search-container {
        padding: 0.5rem;
      }
      #search-input {
        width: calc(100% - 1rem);
        padding: 0.4rem;
        border: 1px solid var(--primary-text);
        border-radius: 4px;
        background-color: var(--secondary-bg);
        color: var(--primary-text);
      }
      #search-input:focus {
        outline-color: var(--hover-primary);
      }
      #note-list-container {
        width:100%;
        position: relative;
        display: flex;
        top: 1rem;
        overflow-y: auto;
        flex-direction: column;
      }
      #note-list {
        list-style-type: none;
        padding: 0.5rem;
        margin: 0;
        flex-grow: 1;
        overflow-y: auto;
      }
      #note-list li {
        padding: 10px;
        padding-left: calc(var(--depth, 0) * 12px + 8px);
        cursor: grab;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        transition: background-color 0.2s;
        user-select: none;
        border-left: 3px solid transparent;
        display: flex;
        align-items: center;
        font-size: 1rem;
        touch-action: pan-y;
        -webkit-touch-callout: none;
      }
      #note-list li:hover { background-color: var(--hover-bg); }
      #note-list li.dragging {
        opacity: 0.75;
        transform: scale(0.99);
        box-shadow: 0 8px 24px var(--drag-shadow);
        border-left-color: var(--hover-primary);
      }
      #note-list li.drop-target {
        background-color: var(--drop-target-bg);
        box-shadow: inset 0 0 0 2px var(--hover-primary);
      }
      #note-list li.highlighted { background-color: var(--accent-color); color: white; }
      #note-list li.selected {
        border-color: var(--hover-primary);
        box-shadow: inset 0 0 0 2px rgba(118, 252, 234, 0.35);
        background-color: rgba(118, 252, 234, 0.12);
        color: var(--primary-text);
      }
      #note-list.drop-target-root {
        box-shadow: inset 0 0 0 2px var(--hover-primary);
        background-color: var(--drop-target-bg);
      }

      .collapse-toggle {
        font-weight:600;
        cursor: pointer;
        width: 20px;
        height: 20px;
        display: inline-block;
        text-align: center;
        margin-right: 4px;
        transition: transform 0.2s ease;
      }
      .collapse-toggle.collapsed { transform: rotate(-90deg); }
      .note-title-text { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; }
      .link-indicator { margin-left: auto; padding-left: 8px; font-size: 0.8rem; opacity: 0.4; }

      #graph-container {
        flex-grow: 1;
        height: 100vh;
        width: 100vw;
        position: relative;
        min-width: 0;
        background-image: radial-gradient(circle, #4a00e0 0%, #2d2d6a 70%);
        z-index: 1; /* Lower z-index */
        touch-action: none; /* Disable browser zoom on graph */
        overscroll-behavior: contain;
      }

      body.theme-bright #graph-container {
        background-image: radial-gradient(circle, #ffffff 0%, #ffffff 70%);
      }

      #css-label-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 2; /* Above graph, below sidebar */
        pointer-events: none;
      }
      .node-label {
        color: white;
        font-family: var(--font-mono);
        /* background-color: #0000001f; */
        font-size: 12px;
        padding: 2px 4px;
        border-radius: 4px;
        text-shadow: 0 0 4px black, 0 0 4px black;
      }
      body.theme-bright .node-label {
        color: #000000;
        text-shadow: none;
        background-color: transparent;
      }
      #graph-tooltip {
        position: absolute;
        background-color: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 5px 10px;
        border-radius: 3px;
        pointer-events: none;
        display: none;
        font-size: 14px;
        z-index: 100;
      }

      #editor-modal, #home-modal, .custom-modal {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        backdrop-filter: blur(8px);
        display: none;
        justify-content: center;
        align-items: center;
        /* transition: transform 0.5s ease; */
      }
      #editor-modal { background-color: var(--bg-color); z-index: 1000; }
      #home-modal { background-color: rgba(10, 10, 21, 0.85); z-index: 2000; }
      .custom-modal { background-color: rgba(10, 10, 21, 0.85); z-index: 3000; }

      .editor-content, .home-modal-content, .custom-modal-content {
        background-color: var(--editor-bg);
        border: 1px solid var(--border-color);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }
      .editor-content {
        width: 100%;
        height: 100%;
        border: none;
        box-shadow: none;
      }
      .home-modal-content, .custom-modal-content { width: 90%; max-width: 650px; padding: 1.5rem 2rem; border-radius: 8px; }
      .custom-modal-content { max-width: 450px; text-align: center; }

      .editor-header {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        font-family: var(--font-mono);
      }
      #note-title-input {
        background: none; border: none;
        color: var(--primary-text);
        font-size: 1.2rem;
        font-weight: 600;
        font-family: var(--font-mono);
        outline: none;
        width: 100%;
        order: 2;
        margin-top: 0.5rem;
      }
      .editor-actions {
        display: flex;
        order: 1;
        align-self: flex-end;
      }
      .editor-actions button {
        background: none; 
        border: 1px solid var(--border-color);
        color: var(--primary-text);
        padding: 6px 12px; margin-left: 10px;
        border-color: var(--primary-text);
        border-radius: 5px; cursor: pointer;
        transition: background-color 0.2s, border-color 0.2s;
      }
      .editor-actions button:hover { color: var(--hover-primary); border-color: var(--hover-primary); }
      /* #save-note-btn { color: rgb(0, 255, 179); border-color: rgb(0, 255, 179); }
      #delete-note-btn { color: rgb(255, 0, 128); border-color: rgb(255, 0, 128); }
      #close-editor-btn { color: var(--primary-text); border-color: var(--primary-text); outline: unset; }
      #close-editor-btn:hover { color: var(--hover-primary); border-color: var(--hover-primary) !important}  */
      .editor-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow: hidden;
        position: relative;
      }
      .note-content-editor {
        flex: 1;
        min-height: 240px;
        /* background: rgba(0, 0, 0, 0.35); */
        border: 1px solid rgba(255, 255, 255, 0.112);
        border-radius: 8px;
        padding: 1.25rem 1.5rem;
        color: var(--primary-text);
        font-family: var(--font-mono);
        font-size: 1rem;
        line-height: 1.6;
        overflow-y: auto;
        white-space: pre-wrap;
        word-break: break-word;
        outline: none;
        touch-action: pan-y;
      }
      .note-content-editor:focus {
        border-color: var(--hover-primary);
        box-shadow: 0 0 0 2px rgba(118, 252, 234, 0.1);
      }
      .note-content-editor:empty::before {
        content: attr(data-placeholder);
        color: var(--secondary-text);
        opacity: 0.6;
        font-style: italic;
        pointer-events: none;
      }
      .note-link {
        background: none;
        border: none;
        padding: 0;
        color: var(--hover-primary);
        font-weight: 600;
        cursor: pointer;
        transition: color 0.2s ease;
        border-bottom: 1px dashed var(--hover-primary);
        font-family: inherit;
      }
      body.theme-bright .note-link {
        color: var(--hover-primary);
        border-bottom-color: rgba(26, 115, 232, 0.5);
      }
      .note-link:hover,
      .note-link:focus {
        color: #ffffff;
      }
      body.theme-bright .note-link:hover,
      body.theme-bright .note-link:focus {
        color: #0b4db8;
      }
      .mention-suggestions {
        position: absolute;
        min-width: 220px;
        background: rgba(10, 10, 21, 0.95);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
        font-family: var(--font-mono);
        font-size: 0.9rem;
        overflow: hidden;
        max-height: 220px;
        overflow-y: auto;
        z-index: 1200;
      }
      .mention-suggestions[hidden] {
        display: none;
      }
      .mention-suggestion-item {
        padding: 8px 12px;
        cursor: pointer;
        color: var(--secondary-text);
        transition: background-color 0.15s ease, color 0.15s ease;
      }
      .mention-suggestion-item:hover,
      .mention-suggestion-item.active {
        background-color: var(--hover-bg);
        color: var(--hover-primary);
      }
      body.theme-bright .mention-suggestions {
        background: rgba(255, 255, 255, 0.95);
        border-color: var(--border-color);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
      }
      body.theme-bright .mention-suggestion-item {
        color: var(--secondary-text);
      }
      body.theme-bright .mention-suggestion-item:hover,
      body.theme-bright .mention-suggestion-item.active {
        background-color: var(--hover-bg);
        color: var(--hover-primary);
      }

      #home-btn {
        border: none;
        font-size: 1rem;
        border-radius: 4px;
        padding: 0;
        font-weight: 400;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3px;
        position: absolute;
        right: 20px;
        top: 1rem;
        width: 32px;
        height: 32px;
        transition: all 0.2s ease;
        z-index: 100;
        cursor: pointer;
      }
      #home-btn span {
        background-color: var(--primary-text);
        border-radius: 2px;
        transition: all 0.3s ease-out;
      }
      #home-btn:hover span {
        background-color: var(--hover-primary);
      }

      #home-btn.active {
        -webkit-transform: rotate(315deg);
        transform: rotate(315deg);
      }

      #home-btn.active span:nth-child(1) {
        -webkit-transform: translate(-7px, -7px);
        transform: translate(-7px, -7px);
        opacity: 0;
      }
      #home-btn.active span:nth-child(2) {
        -webkit-transform: translate(7px, -7px);
        transform: translate(7px, -7px);
        opacity: 0;
      }
      #home-btn.active span:nth-child(3) {
        -webkit-transform: translate(-7px, 7px);
        transform: translate(-7px, 7px);
        opacity: 0;
      }
      #home-btn.active span:nth-child(4) {
        -webkit-transform: translate(7px, 7px);
        transform: translate(7px, 7px);
        opacity: 0;
      }

      

      .home-modal-header { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
      
      .home-modal-controls { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }
      .home-modal-controls > * { flex: 1 1 140px; }
      .home-modal-controls button#logout-btn { flex: 0 0 auto; }
      .home-modal-controls select, .home-modal-controls button { background: transparent; color: var(--primary-text); border: 1px solid var(--border-color); padding: 8px 12px; border-radius: 5px; cursor: pointer; font-family: var(--font-mono); transition: all 0.2s ease; }
      .home-modal-controls select:hover, .home-modal-controls button:hover { border-color: var(--hover-primary); color: var(--hover-primary); }

      .home-modal-header-top-row {display: flex !important; flex-direction: row; width: 100% !important; background-color: var(--sidebar-bg); border-top-left-radius: 8px; border-top-right-radius: 8px;}
      .home-modal-header h1 {  float: left; margin: 0.5rem 0 0 1rem; font-size: 1.25rem; display: flex; align-items: flex-start; color: var(--hover-primary)}
      #close-home-modal-btn { margin-left: auto; float: right; display: flex; color: var(--primary-text); border-color: var(--primary-text); outline: unset; padding: 8px 12px; font-size: 1rem; background-color: transparent; border: 1px solid var(--border-color);  border-radius: 5px; cursor: pointer; transition: all 0.2s; font-family: var(--font-mono);}
      #close-home-modal-btn:hover { color: var(--hover-primary); border-color: var(--hover-primary) !important} 


      #collection-list { list-style: none; padding: 0; margin: 0 0 1.5rem 0; max-height: 50vh; overflow-y: auto; }
      #collection-list li { display: flex; align-items: center; padding: 10px; border-radius: 4px; margin-bottom: 8px; background-color: var(--editor-bg); border: 1px solid var(--border-color); cursor: pointer; transition: background-color 0.2s, border-color 0.2s; }
      #collection-list li:hover { background-color: var(--hover-bg); border-color: var(--hover-primary); }
      .collection-name { flex-grow: 1; font-size: 1.1rem; }
      .collection-actions { display: flex; }
      .collection-actions button { background: transparent; border: 1px solid transparent; color: var(--secondary-text); cursor: pointer; font-size: 1.1rem; padding: 4px; transition: all 0.2s; border-radius: 4px; width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; }
      .collection-actions button:hover { color: var(--hover-primary); background-color: var(--hover-bg); border-color: var(--hover-primary); }

      #new-collection-btn { width: 100%; padding: 12px; font-size: 1rem; background-color: transparent; border: 1px dashed var(--border-color); color: var(--primary-text); border-radius: 5px; cursor: pointer; transition: all 0.2s; }
      #new-collection-btn:hover { border-color: var(--hover-primary); color: var(--hover-primary); background-color: var(--hover-bg); }

      .custom-modal-content h2 { margin-top: 0; font-size: 1.5rem; }
      .custom-modal-content p { margin-bottom: 1.5rem; line-height: 1.6; color: var(--secondary-text); }
      .custom-modal-input { width: calc(100% - 20px); padding: 10px; margin-bottom: 1.5rem; background-color: var(--bg-color); border: 1px solid var(--border-color); color: var(--primary-text); border-radius: 4px; font-family: var(--font-mono); }
      .custom-modal-buttons { display: flex; justify-content: center; gap: 1rem; }
      .custom-modal-buttons button { background: transparent; border: 1px solid var(--border-color); color: var(--primary-text); padding: 10px 20px; border-radius: 5px; cursor: pointer; font-family: var(--font-mono); transition: all 0.2s ease; }
      .custom-modal-buttons button:hover { border-color: var(--hover-primary); color: var(--hover-primary); background-color: var(--hover-bg); }
      .custom-modal-buttons button.danger { border-color: rgb(255, 0, 128); color: rgb(255, 0, 128); }
      .custom-modal-buttons button.danger:hover { background-color: rgba(255, 0, 128, 0.1); }

      @media (max-width: 600px) {
        #note-title-input {
          font-size: 1.2rem;
        }
        .home-modal-content {
          padding: 1.5rem 1rem;
        }
      }
