/* /public/css/flowmap.css */

html,
body {
    background: linear-gradient(
        105deg,
        #191c22 0%,
        #282a34 38%,
        #393b47 100%
    ) !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    background-position: center center !important;
    background-size: cover !important;
    min-height: 100vh !important;
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: clip !important;
    overscroll-behavior: none !important;
    touch-action: none !important;
}

::-webkit-scrollbar,
body::-webkit-scrollbar,
html::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    background: transparent !important;
}

@media (max-width: 1200px) {
    #note-inject-here {
        display: none !important;
    }
}

#note-inject-here {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1001 !important;
    width: 0;
    height: 0;
    pointer-events: none;
    margin-top: 28px;
}
#ad-inject-here {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    z-index: 1001 !important;
    margin-top: 32px !important;
    pointer-events: auto !important;
}
#ad-inject-here * {
    z-index: 1001 !important;
    pointer-events: auto !important;
}

#header {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    z-index: 1100;
    background: #fff; /* Or match your site's color */
}
#footer {
    bottom: 0;
}
canvas {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    pointer-events: none;
    z-index: 1;
}
.node {
    transition: none !important;
    position: absolute;
    background-color: #f0f0ff;
    border: 2px solid #c15cff;
    width: 120px;
    height: 120px;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
    cursor: move;
}
.node.circle {
    border-radius: 50%;
}
.node.square {
    border-radius: 10px;
}
.node p {
    margin: 0;
    font-size: 12px;
}
.node h4,
.node p {
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text !important;
    pointer-events: auto !important;
    outline: none !important;
    z-index: 20;
}
.selected {
    border-color: #008cff;
    cursor: pointer;
}
#ui-toolbar {
    position: fixed;
    left: 0;
    right: 0;
    top: 5px; /* Managed by JS if header is present */
    margin-left: auto;
    margin-right: auto;
    background: #fff;
    border: 1px solid #cfcfff;
    border-radius: 8px;
    padding: 6px 16px;
    box-shadow: 0 2px 10px #aaa2;
    display: flex;
    gap: 1px;
    align-items: center;
    width: max-content;
    max-width: calc(100vw - 32px);
    z-index: 1100;
    margin-top: 5px;
    min-width: 0;
    box-sizing: border-box;
    flex-wrap: wrap;
    justify-content: center;
    left: 50%;
    transform: translateX(-50%);

    opacity: 0.91; /* or adjust: 0.85–0.95 for taste */
    backdrop-filter: blur(1.5px); /* subtle glass feel */
}

.header-collapsed {
    display: none !important;
}

#ui-toolbar button {
    cursor: pointer;
}
#ui-toolbar button.selected {
    background: #d0d0fb;
    border-color: #8888ff;
}

#ui-toolbar button,
#ui-toolbar select {
    height: 32px;
    min-width: 68px;
    font-size: 14px;
    font-family: "Segoe UI", Arial, sans-serif;
    line-height: 1.3;
    vertical-align: middle;
}

.select-wrapper {
    position: relative;
    display: inline-block;
}

/* Tooltip: Consistent style and position for both button and select */
.tooltip {
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 13px;
    visibility: hidden;
    opacity: 0;
    background: #222;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 4px 10px;
    position: absolute;
    z-index: 1000;
    left: 50%;
    top: -34px;
    transform: translateX(-50%);
    transition: opacity 0.18s;
    pointer-events: none;
    white-space: nowrap;
    font-weight: normal;
    line-height: 1.29;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.21);
}

button:hover .tooltip,
.select-wrapper:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Offset for the button tooltip so both are level */
.tooltip-offset {
    top: -26px;
}

.node {
    transition:
        width 0.13s,
        height 0.13s;
}

/* ZOOM */

#zoom-container {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    transform-origin: 50% 50%;
    z-index: 2;
    pointer-events: none;
}
#zoom-container > .node {
    pointer-events: auto;
}
/*Footer popup/down*/
.footer-popup {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%) translateY(100%);
    width: auto;
    min-width: 320px;
    max-width: 95vw;
    max-height: 55vh;
    background: #fff;
    box-shadow: 0px -8px 32px #21223942;
    border-radius: 18px 18px 0 0;
    z-index: 8888;
    transition: transform 0.22s cubic-bezier(0.54, 0.13, 0.5, 1.16);
    pointer-events: none;
    padding: 0;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    border: 2.5px solid #bdb4fd;
    opacity: 0.98;
}
.footer-popup.open {
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
.header-toggle,
.footer-toggle {
    position: fixed;
    left: 50%;
    z-index: 1200;
    font-size: 1rem;
    padding: 3px 14px 1px 13px;
    outline: none;
    pointer-events: auto;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    background: linear-gradient(109deg, #232429 60%, #393b4a 150%) !important;
    color: #c7edff !important;
    border: 2px solid #232440 !important;
    box-shadow: 2px 2px 18px 0 #0004 !important;
    opacity: 0.62 !important;
    transition:
        top 0.25s,
        left 0.25s,
        background 0.17s;
}
.header-toggle {
    top: -3px;
    border-radius: 0 0 12px 12px !important;
    transform: translateX(-50%);
}
.footer-toggle {
    z-index: 99999 !important;
    position: fixed;
    left: 50%;
    bottom: -3px;
    border-radius: 12px 12px 0 0 !important;
    font-size: 1rem;
    padding: 3px 14px 1px 13px;
    outline: none;
    pointer-events: auto !important;
    background: linear-gradient(109deg, #232429 60%, #393b4a 150%) !important;
    color: #c7edff !important;
    border: 2px solid #232440 !important;
    box-shadow: 2px 2px 18px 0 #0004 !important;
    opacity: 0.9 !important;
    transform: translateX(-50%);
    cursor: pointer;
    transition:
        top 0.25s,
        left 0.25s,
        background 0.17s;
}

.footer-popup::-webkit-scrollbar {
    width: 7px;
}
.footer-popup::-webkit-scrollbar-thumb {
    background: #eee;
    border-radius: 5px;
}

#mindmap-canvas-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    /* width/height will be set via JS to fit 50% editing space */
    z-index: 2;
}

#mindmap-canvas-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2; /* Above lines */
}

#mindmap-canvas-wrapper > .node {
    position: absolute;
    z-index: 3; /* Above canvas and lines */
}

/*Cant highlight dropdowns*/
select:focus,
select:active {
    outline: none !important;
    user-select: none !important;
    background: inherit !important;
    color: inherit !important;
}
select::-ms-value {
    background: inherit !important;
    color: inherit !important;
}
select::-moz-focus-inner {
    border: 0 !important;
}
select {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

#mindmap-canvas-wrapper,
#canvas {
    width: 100%;
    height: 100%;
}
#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none !important;
}
/*Hand Grab*/
#hand-tool-btn.active {
    background: #ededfa;
    border-color: #8888ff;
}
.hand-cursor {
    cursor: grab !important;
}
.hand-grab {
    cursor: grabbing !important;
}

.hand-cursor {
    cursor: grab !important;
}
.hand-grab {
    cursor: grabbing !important;
}

#mindmap-canvas-wrapper {
    position: absolute;
    left: 0;
    top: 0;
    /* width/height set by JS; workspace is always the same at all zooms */
}
#mindmap-border {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 999;
    border: 3px dashed #c15cff;
    pointer-events: none;
    background: none;
    box-sizing: border-box;
    width: 3600px; /* <-- MATCH areaW */
    height: 2400px; /* <-- MATCH areaH */
    transform: translate(-50%, -50%);
}
/*Selection marquee*/

#selection-marquee {
    position: absolute;
    z-index: 99;
    border: 2px solid #008cff;
    background: rgba(0, 140, 255, 0.1);
    pointer-events: none;
    display: none;
}
.node.selected {
    border-color: #008cff !important;
    box-shadow: 0 0 0 3px #008cff33;
}
.node.textbox.selected {
    border-color: #008cff !important;
    box-shadow: 0 0 0 3px #008cff33 !important;
}

/*UI BETTER LOOK*/

.ctrl-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 72px;
    gap: 2px;
}

#ui-toolbar .ctrl-group label {
    font-weight: bold;
    font-size: 14px;
    color: #44447c;
    margin-bottom: 2px;
    text-align: center;
    width: 100%;
    line-height: 1.03;
    user-select: none;
}

#ui-toolbar button,
#ui-toolbar select {
    border-radius: 6px;
    border: 1px solid #cfcfff;
    background: #fff;
    padding: 0 7px;
}

#ui-toolbar button.selected,
#ui-toolbar button.active {
    background: #e5e6fe;
    border-color: #7c8cff;
}

#ui-toolbar button:hover,
#ui-toolbar select:hover {
    border-color: #786fdc;
}

#ui-toolbar button:focus,
#ui-toolbar select:focus {
    outline: 2px solid #b6bfff;
}

#ui-toolbar select {
    min-width: 68px;
}

#center-btn {
    pointer-events: auto !important;
    z-index: 9999 !important;
    position: relative;
    background: #eee;
}
#ui-toolbar,
#ui-toolbar * {
    pointer-events: auto !important;
}
/*4 btns not interact*/

#ui-toolbar .ctrl-group label {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    pointer-events: none;
}
#ui-toolbar .ctrl-group button,
#ui-toolbar .ctrl-group select {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}
#ui-toolbar .ctrl-group {
    user-select: none !important;
    -webkit-user-select: none !important;
}
/*Pan tool fade*/
#ui-toolbar.pan-mode .ctrl-group:not(.pan-tool):not(:has(#center-btn)) * {
    pointer-events: none !important;
}
#ui-toolbar.pan-mode .ctrl-group:not(.pan-tool):not(:has(#center-btn)) {
    opacity: 0.45;
    filter: grayscale(1);
}
#ui-toolbar.mode-fade
    .ctrl-group:not(.pan-tool):not(.select-tool):not(:has(#center-btn))
    * {
    pointer-events: none !important;
}
#ui-toolbar.mode-fade
    .ctrl-group:not(.pan-tool):not(.select-tool):not(:has(#center-btn)) {
    opacity: 0.45;
    filter: grayscale(1);
}
#ui-toolbar.mode-fade .ctrl-group.pan-tool,
#ui-toolbar.mode-fade .ctrl-group.select-tool,
#ui-toolbar.mode-fade .ctrl-group.center-group {
    opacity: 1 !important;
    pointer-events: auto !important;
    filter: none !important;
}

#ui-toolbar .ctrl-group.pan-tool {
    opacity: 1 !important;
    pointer-events: auto !important;
    filter: none !important;
}
/*LINE COLOR DOT*/
.line-color-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: #d7d9ef;
    border-radius: 50%;
    border: 2px solid #fff;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 2px #0001;
    pointer-events: none;
    z-index: 1;
    opacity: 0.45;
}

.node.textbox .line-color-dot {
    z-index: 1 !important;
}

.node p {
    position: relative;
    z-index: 2;
    background: transparent;
}
/*SAVE/LOAD*/
#mindmap-load-btn,
#mindmap-save-btn {
    min-width: 0 !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 3px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-sizing: border-box;
    border-radius: 6px;
    background: transparent;
    border: none;
}
#mindmap-load-input,
#mindmap-save-input {
    width: 110px;
    height: 28px;
    font-size: 15px;
    padding: 2px 8px;
    border-radius: 5px;
    outline: none;
    border: 1px solid #cfcfff;
    background: #fff;
    color: #333;
}

#mindmap-save-input:focus,
#mindmap-load-input:focus {
    border-color: #786fdc;
    background: #f5f6ff;
}
#mindmap-load-btn,
#mindmap-save-btn {
    background: transparent;
    border: none;
    padding: 2px 1px 2px 1px; /* top right bottom left */
    margin-left: 4px;
    display: flex;
    align-items: center;
    height: 28px;
}
.load-group,
.save-group {
    min-width: 0;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 0;
}

/*Settings/help btn*/

#help-btn,
#settings-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;

    padding: 0 2px !important;
    margin: 0 !important;
    color: #7d77df;
    font-size: 36px;
    line-height: 1;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
    display: inline;
    min-width: 0 !important;
    min-height: 0 !important;
    vertical-align: middle;
    position: static !important;
}
#help-btn {
    margin-right: 12px !important;
    padding: 0 3.5px !important;
}

#settings-btn {
    margin-left: 12px !important;
}

#help-btn:hover,
#settings-btn:hover {
    background: #d6d5f4 !important;
    color: #453ba7 !important;
    cursor: pointer;
    box-shadow: 0 0 0 2px #746bcf !important;
    border-radius: 50px !important;
}
#settings-btn {
    padding-top: 0px !important;
    padding-bottom: 1px !important;
}
/* DROPDOWN SHARED STYLES FOR SETTINGS/HELP */
.dropdown-menu-parent {
    flex-shrink: 0;
    position: relative;
    display: inline-block;
}

.settings-btn {
    background: none;
    border: none;
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.18s;
    position: relative;
}
.settings-btn:hover {
    background: #222;
}

.has-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 3px;
    background-color: #777;
    color: white;
    border-radius: 5px;
    font-size: 6px;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1;
    padding: 1px 4px;
    line-height: 1;
}
.has-tooltip:hover::after {
    opacity: 1;
}

/* Dropdown content styles */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #444;
    border-radius: 8px;
    min-width: 250px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 12001 !important;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 10px;
}
.dropdown-content.show {
    display: block;
}
/* Settings dropdown (right aligned from button) */
#settings-dropdown.dropdown-content {
    left: auto;
    right: 0;
    transform: none;
    min-width: 220px;
    padding: 18px 18px 14px 18px;
    box-sizing: border-box;
    text-align: left;
}
/* Help dropdown (left aligned from button, shifts right visually) */
#help-dropdown.dropdown-content {
    right: auto;
    left: 0;
    transform: none;
    min-width: 220px;
    padding: 18px 18px 14px 18px;
    box-sizing: border-box;
    text-align: left;
}

.settings-dropdown-nice {
    background: #232429 !important;
    color: #fff;
    box-shadow:
        0 8px 24px rgba(30, 40, 60, 0.33),
        0 1.5px 8px rgba(0, 0, 0, 0.25);
    padding-top: 30px !important;
    padding-bottom: 30px !important;
    padding-left: 40px !important;
    padding-right: 40px !important;
    min-width: 300px !important;
    max-width: 98vw !important;
    border-radius: 18px !important;
    border: 1.5px solid #343a40;
}

#help-dropdown.dropdown-content,
#settings-dropdown.dropdown-content {
    max-height: 72vh;
    overflow-y: auto;
    overscroll-behavior: contain; /* Prevent scroll chaining to body */
}

.settings-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 16px;
    letter-spacing: 1px;
    color: #ededed;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.settings-dropdown-nice .settings-row {
    display: flex;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
    justify-content: space-between;
}

.settings-dropdown-nice label {
    font-size: 16px;
    color: #fff !important;
    min-width: 82px;
    margin: 0;
}

.settings-dropdown-nice select {
    width: 210px;
    min-width: 210px;
    max-width: 210px;
    background-color: #383b42 !important;
    color: #fafafa !important;
    border: 1.2px solid #4b4b5d;
    border-radius: 6px;
    font-size: 15px;
    padding: 7px 10px;
    margin-bottom: 0 !important;
}
.settings-dropdown-nice .ctrl-group {
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    #settings-dropdown.settings-dropdown-nice #sync-vocab-actions button,
    #settings-dropdown.settings-dropdown-nice #download-mindmap-btn,
    #settings-dropdown.settings-dropdown-nice #view-pdf-btn {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 280px !important;
        font-size: 14px !important;
        padding: 8px 0 !important;
        box-sizing: border-box !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }
    #settings-dropdown .ctrl-group > button,
    #settings-dropdown .ctrl-group > select {
        min-width: 0 !important;
        width: 98% !important;
        max-width: 285px !important;
        font-size: 13px !important;
    }
    #settings-dropdown #sync-vocab-search {
        max-width: 99vw !important;
        width: 120px !important;
        min-width: 0 !important;
    }
    #settings-dropdown #sync-vocab-dd-btn {
        width: 35px !important;
        min-width: 0 !important;
    }
}

#ui-toolbar .ctrl-group.center-group {
    z-index: 1;
}
#settings-dropdown.settings-dropdown-nice {
    z-index: 12001 !important;
}

#settings-dropdown.settings-dropdown-nice select:hover {
    cursor: pointer;
}

.nodes-info {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 5px;
    text-align: center;
}

#help-btn,
#settings-btn {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

#mindmap-border {
    z-index: 1;
}

#mindmap-canvas-wrapper > .node,
#mindmap-canvas-wrapper canvas,
#selection-marquee {
    z-index: 2;
    position: absolute;
}
/*Node rectangle box*/
.node.rectangle {
    border-radius: 10px;
    transition: none !important;
}
/*Node text box*/
.node.textbox {
    border-radius: 6px !important;
    background: #fffdf9 !important;
    border: 2px solid #c15cff !important;
    min-width: 120px !important;
    min-height: 32px !important;
    width: 170px;
    height: 38px;
    box-shadow: 0 2px 12px #adc4e566;
    text-align: left !important;
    padding: 0px 5px !important;
    resize: none;
    display: flex;

    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
}
.node.textbox h4,
.node.textbox p {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    max-width: 100%;
    white-space: pre-line !important;
    overflow-x: hidden !important;
    text-overflow: ellipsis !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    vertical-align: middle !important;
    line-height: 1.05 !important;
    position: relative;
    z-index: 2 !important;
    background: transparent;
    display: inline-block !important;
}
.node.textbox h4 {
    position: relative !important;
    top: -3px !important;
    margin-bottom: 0px !important;
}
.node.textbox h4::-webkit-scrollbar,
.node.textbox p::-webkit-scrollbar {
    display: none;
}

.node.textbox {
    overflow-x: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
}
.node.textbox p {
    margin-top: 4px !important;
    margin-left: 3px;
    position: relative !important;
    top: -1px !important; /* match/tweak as needed */
}
/*Resize dot*/

.resize-dot {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    width: 12px !important;
    height: 12px !important;
    min-width: 12px !important;
    min-height: 12px !important;
    background: #a692ff;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1.5px 5px #594eff35;
    cursor: move !important;
    z-index: 10000 !important;
    opacity: 0.38;
    transition:
        box-shadow 0.16s,
        background 0.14s,
        border-color 0.14s;
    pointer-events: auto !important;
}
.resize-dot:hover {
    background: #533fa8;
    border-color: #b6bfff;
}
.node .resize-dot,
.node .resize-dot::after {
    pointer-events: auto !important;
    z-index: 10000 !important;
}

.node {
    position: relative;
}
.node .resize-dot {
    z-index: 10000 !important;
    pointer-events: auto !important;
}
.node .resize-dot {
    position: absolute;
}
.node .resize-dot,
.node .resize-dot::after {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    pointer-events: auto !important;
}
.node .resize-dot::before {
    content: "";
    position: absolute;
    top: -8px;
    left: -8px;
    width: 34px;
    height: 34px;
    background: transparent;
    z-index: 10001 !important;
    pointer-events: auto !important;
}

/* Ensure node text, header, and description are above the dot */
.node h4,
.node p {
    position: relative;
    z-index: 2 !important;
}

.node.circle {
    position: relative;
}

/* Smaller resize dot and balanced glow */
.node .resize-dot {
    z-index: 1 !important;
    width: 12px !important;
    height: 12px !important;
    min-width: 12px !important;
    min-height: 12px !important;
    box-shadow: 0 1.5px 5px #594eff35;
    /* Same pointer-events and z-index as before */
    pointer-events: auto !important;
    z-index: 20;
    cursor: grab !important;
    background: #a692ff;
    border-color: #b6bfff;
    transition:
        box-shadow 0.16s,
        background 0.14s,
        border-color 0.14s;
}

/* Shrink hitbox only a little for precision, still easier to click */
.node .resize-dot::after {
    z-index: 2 !important;
    content: "";
    position: absolute;
    left: -4px;
    top: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: transparent;
    pointer-events: auto;
}

/* ON HOVER: blueish glow, scaled for smaller dot */
.node .resize-dot:hover,
.node .resize-dot.glow-hover {
    z-index: 3 !important;
    box-shadow:
        0 0 0 4px #8368ff55,
        0 2.5px 12px #5a60ff22;
    background: #7151ff !important;
    border-color: #e5eafe !important;
    z-index: 21 !important;
}

/* ON ACTIVE (mousedown/drag): gold glow, scaled for smaller dot */
.node .resize-dot:active,
.node .resize-dot.glow-active {
    box-shadow:
        0 0 0 5px #ffd84d70,
        0 2.5px 16px #ffd84d33;
    background: #ffd84d !important;
    border-color: #fffbe7 !important;
    z-index: 22 !important;
}
.resize-dot:active,
.resize-dot.glow-active {
    cursor: grabbing !important;
}
/*Anti text highligh while dragging nodes*/

body.node-action,
body.node-action * {
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: grab !important;
}

/* Force node contents (header & description) to scroll inside the node if overflow */
.node {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.node-inner {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
.node h4,
.node p {
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    margin: 0 0 2px 0;
    padding: 0 4px;
    /* Remove explicit overflow: hidden here if you had it */
}
.node h4 {
    margin: 5px 0;
    font-size: 18px;
}
.node p {
    margin: 0;
    font-size: 16px;
}
.node.circle .node-inner {
    width: 93%;
    max-width: 93%;
    margin: 0 auto;
    box-sizing: border-box;
}

.node.circle h4 {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
    display: block;
    box-sizing: border-box;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
}

.node.circle p {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
    display: block;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
}

.node.textbox h4:empty::after,
.node.textbox p:empty::after {
    content: "\200b";
    display: inline-block;
    min-width: 48px;
    min-height: 21px;
    /* Bigger and easier to click - adjust as you want */
}

/* Place the resize dot OUTSIDE the bottom-right for tiny circles only */
/* Make the resize dot appear outside the lower-right for tiny circles (width = 60px) */
/* Fix for tiny circle, force resize dot fully outside */

/* Dot for tiny square/rectangle (width = 60px only): */
.node.square[style*="width: 60px"] .resize-dot,
.node.square[style*="width:60px"] .resize-dot {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: -8px !important;
    margin: 0 !important;
    transform: translateX(-50%) !important;
    z-index: 9999 !important;
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
.node.rectangle[style*="width: 108px"] .resize-dot,
.node.rectangle[style*="width:108px"] .resize-dot {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: -8px !important;
    margin: 0 !important;
    transform: translateX(-50%) !important;
    z-index: 9999 !important;
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
/*Resize toolbar UI for smaller screens*/

@media (max-width: 900px) {
    #ui-toolbar {
        max-width: 99vw;
        padding-left: 2vw;
        padding-right: 2vw;
        gap: 10px 6px;
    }
}
@media (max-width: 600px) {
    #ui-toolbar {
        padding-left: 1vw;
        padding-right: 1vw;
        max-width: 99vw;
        gap: 8px 2px;
    }
}
@media (max-width: 400px) {
    #ui-toolbar {
        gap: 6px 0.5vw;
        max-width: 100vw;
        padding-left: 0;
        padding-right: 0;
    }
    .settings-dropdown-nice {
        right: -50px !important;
    }
}

/* Default: Hide border, dot, and resize for unselected .node.textbox */
.node.textbox {
    border-color: transparent !important;
    box-shadow: none !important;
}
.node.textbox .line-color-dot,
.node.textbox .resize-dot {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.12s;
}
.node.textbox .resize-dot {
    bottom: 0px !important;
}

/* Selected: Show border, dot, and resize for .node.textbox.selected */
.node.textbox.selected {
    border-color: #008cff !important;
    box-shadow: 0 0 0 3px #008cff33 !important;
}
.node.textbox.selected .line-color-dot,
.node.textbox.selected .resize-dot {
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.node-action,
body.node-action * {
    touch-action: none !important;
}

/* Reduce header-desc gap for all nodes except textboxes */
.node:not(.textbox) h4 {
    margin-bottom: 0px !important;
}
.node:not(.textbox) p {
    margin-top: 2px !important;
}

@media print {
    @page {
        size: auto;
    }

    #mindmap-border {
        border: none !important;
        background: none !important;
    }

    #ui-toolbar,
    #header,
    #footer-popup,
    #footer-toggle,
    #header-toggle,
    .dropdown-content {
        display: none !important;
        visibility: hidden !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

/* --- Futuristic, Flowy, Gradient Gray Toolbar and Button Theme (COLORS ONLY, NO SIZING) --- */

/* --- Toolbar/Group/Button Visual Smoothing & Rounding Override --- */

#ui-toolbar {
    background: linear-gradient(
        105deg,
        #191c22 0%,
        #282a34 38%,
        #393b47 100%
    ) !important;
    border: 1.5px solid #333540 !important;
    box-shadow:
        0 7px 46px #161728c7,
        0 2.5px 10px #46507c1a;
    border-radius: 22px !important;
    background-image:
        repeating-linear-gradient(120deg, #2222 0 2px, transparent 2px 22px),
        linear-gradient(105deg, #232429a8 0%, #2324290d 100%);
}
#ui-toolbar .ctrl-group {
    background: linear-gradient(120deg, #232429 0%, #25262a 100%) !important;
    border: 1.5px solid #3335401f !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 18px #2b30382d;
}

/* Softly round/smooth ALL toolbar buttons and selects */
#ui-toolbar button,
#ui-toolbar select {
    background: linear-gradient(
        103deg,
        #22242a 0,
        #24262f 65%,
        #303238 100%
    ) !important;
    border: 1.8px solid #3d4046 !important;
    box-shadow: 0 0.5px 6.5px #41414f33 !important;
    color: #c8ccef !important;
    font-weight: 500;
    letter-spacing: 0.01em;
    outline: none !important;
    border-radius: 14px !important;
    transition:
        background 0.14s,
        box-shadow 0.13s,
        border-color 0.13s,
        color 0.13s;
}

/* Extra smoothing/shadow/round/corner when hovered/focused */
#ui-toolbar button:hover,
#ui-toolbar select:hover,
#ui-toolbar button:focus,
#ui-toolbar select:focus {
    background: linear-gradient(
        103deg,
        #292c37 0,
        #363747 85%,
        #202028 100%
    ) !important;
    border-color: #d78cff !important;
    color: #fff !important;
    box-shadow:
        0 0 0 3px #d078ff42,
        0 6px 32px #7967d338 !important;
    border-radius: 16px !important;
}

#ui-toolbar button.selected,
#ui-toolbar button.active {
    background: linear-gradient(
        108deg,
        #3b2236 0,
        #442445 130%,
        #ea61b57c 175%
    ) !important;
    border-color: #fc80c6 !important;
    color: #fc3fa9 !important;
    box-shadow:
        0 0 28px 0 #fc50cc99,
        0 0 16px 0 #eb49b8cf,
        0 0 2px #fff2 !important;
    border-radius: 17px !important;
}

#ui-toolbar .ctrl-group input[type="text"] {
    background: linear-gradient(102deg, #232429 60%, #393b4a 150%) !important;
    color: #e2e7ff !important;
    border: 1.2px solid #35385a !important;
    border-radius: 8px !important;
    box-shadow: 0 0.5px 12px #16162833;
}
#ui-toolbar .ctrl-group input[type="text"]:focus {
    border-color: #ab80ff !important;
    background: #232142 !important;
    color: #fff !important;
}

#center-btn {
    background: linear-gradient(90deg, #282a38 60%, #35375a 150%) !important;
    color: #c2c6de !important;
    border: 1.5px solid #3a3c48 !important;
    border-radius: 14px !important;
}

.settings-dropdown-nice {
    background: linear-gradient(
        105deg,
        #24262b 0%,
        #32344a 72%,
        #1a1b1f 100%
    ) !important;
    color: #f5e1ff !important;
    border: 1.7px solid #363c48 !important;
    box-shadow:
        0 14px 48px #191032c2,
        0 3px 13px #34074c33 !important;
    border-radius: 19px !important;
}

#ui-toolbar .ctrl-group label {
    margin-bottom: 0px !important;
    padding-bottom: 0px !important;
    line-height: 1.12 !important;
    font-size: 13px !important;
    letter-spacing: 0.01em;
}
#ui-toolbar .ctrl-group > *:not(label) {
    margin-top: 0px !important;
}

#ui-toolbar .load-group,
#ui-toolbar .save-group {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    padding-right: 4px !important;
    background: linear-gradient(120deg, #1a1b1f 0%, #181717 100%) !important;
}

#ui-toolbar select {
    background: linear-gradient(110deg, #22242a 0%, #2b2d35 100%) !important;
    color: #e6e9ed !important;
    border: 1.5px solid #494b57 !important;
    box-shadow: 0 1.4px 7px #2324332a !important;
}

/* Style dropdown menu (the open list) for Chrome/Edge */
#ui-toolbar select:focus,
#ui-toolbar select:active {
    background: linear-gradient(110deg, #272933 0%, #333542 100%) !important;
    color: #fff !important;
    border-color: #a180ff !important;
}

/* Optional: Remove default "arrow" and make custom—uncomment if you want a custom style
#ui-toolbar select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url('data:image/svg+xml;utf8,<svg width="18" height="18" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><polygon points="7,10 14,19 21,10" fill="%23999"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 26px !important;
}
*/

#ui-toolbar select option {
    background: #282a34 !important;
    color: #ececff !important;
}

.node h4,
.node p {
    touch-action: manipulation !important;
}

.node .resize-corner {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background: #232340;
    border-radius: 50%;
    border: 2.5px solid #181733;
    z-index: 99;
    opacity: 0.96;
    cursor: nwse-resize !important;
    display: none;
    box-shadow:
        0 2px 12px #10101a,
        0 1px 3px #0008;
    pointer-events: auto;
    transition:
        background 0.2s,
        opacity 0.2s;
}
.node .shape-corner {
    position: absolute;
    top: -12px;
    left: -12px;
    width: 28px;
    height: 28px;
    background: #232340;
    border-radius: 50%;
    border: 2.5px solid #181733;
    z-index: 99;
    opacity: 0.96;
    cursor: pointer !important;
    display: none;
    box-shadow:
        0 2px 12px #10101a,
        0 1px 3px #0008;
    pointer-events: auto;
    transition:
        background 0.2s,
        opacity 0.2s;
}

.node.selected .resize-corner {
    display: block;
}
.node .resize-corner:active {
    background: #ffd84deb !important;
    opacity: 1;
    cursor: nwse-resize !important;
    border-color: #fffbe7 !important;
}
.node .resize-corner::after {
    content: "↘";
    display: block;
    position: absolute;
    left: 3px;
    top: 1px;
    font-size: 19px;
    font-weight: bold;
    color: #fff;
    opacity: 0.97;
    pointer-events: none;
    text-shadow:
        0 2px 8px #232340,
        0 0px 2px #0009;
}

.node.selected .shape-corner {
    display: block;
}
.node .shape-corner:active {
    background: #70c2ff !important;
}
.node .shape-corner::after {
    content: "⬚";
    display: block;
    position: absolute;
    left: 5px;
    top: 1px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    opacity: 0.97;
    pointer-events: none;
    text-shadow:
        0 2px 8px #232340,
        0 0px 2px #0009;
}
.node.circle[size="60"] .resize-corner {
    right: -8px !important;
    top: -8px !important;
}
.node.circle[size="90"] .resize-corner {
    right: -4px !important;
    top: -4px !important;
}
.node.circle[size="120"] .resize-corner {
    right: 1px !important;
    top: 1px !important;
}
.node.circle[size="160"] .resize-corner {
    right: 7px !important;
    top: 7px !important;
}
.node.circle[size="230"] .resize-corner {
    right: 18px !important;
    top: 18px !important;
}

.node.circle[size="60"] .shape-corner {
    left: -8px !important;
    top: -8px !important;
}
.node.circle[size="90"] .shape-corner {
    left: -4px !important;
    top: -4px !important;
}
.node.circle[size="120"] .shape-corner {
    left: 1px !important;
    top: 1px !important;
}
.node.circle[size="160"] .shape-corner {
    left: 7px !important;
    top: 7px !important;
}
.node.circle[size="230"] .shape-corner {
    left: 18px !important;
    top: 18px !important;
}

/*Download JSON*/

#download-mindmap-btn {
    background: linear-gradient(
        103deg,
        #22242a 0,
        #24262f 65%,
        #303238 100%
    ) !important;
    color: #e0caf8 !important;
    border: 1.5px solid #464250 !important;
    font-weight: bold;
    border-radius: 14px !important;
    font-size: 15px;
    transition:
        box-shadow 0.14s,
        background 0.15s,
        border-color 0.13s,
        color 0.13s;
}
#download-mindmap-btn:hover {
    background: linear-gradient(
        103deg,
        #282a37 0%,
        #d452ac14 85%,
        #212029 100%
    ) !important;
    color: #fff !important;
    border-color: #d186ff !important;
    box-shadow:
        0 0 0 3px #ab6be173,
        0 6px 32px #9a76db28 !important;
}
#download-mindmap-btn:active {
    box-shadow:
        0 0 0 5px #fff7846a,
        0 9px 42px #c9d6ff33 !important;
    background: #361c4c !important;
    color: #ffd !important;
    border-color: #ffd84d !important;
}

/*Footer covering page fix START*/

#footer-content > .wrapper {
    min-height: 0 !important;
    height: auto !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
}
#footer-content > .wrapper main {
    display: none !important;
}
#footer-content > .wrapper .site-footer {
    flex-shrink: 0 !important;
    position: static !important;
    background: #222 !important;
    border-radius: 16px 16px 0 0;
    width: 100% !important;
}
#footer-content {
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 95vw;
    max-height: 55vh;
    overflow-y: auto;
}
/*Footer covering page fix END*/

@media (max-width: 700px) {
    #ui-toolbar {
        font-size: 10px !important;
        padding: 1px 3px !important;
    }
    #ui-toolbar .ctrl-group label {
        font-size: 9px !important;
    }
    #ui-toolbar .ctrl-group {
        min-width: 38px !important;
        gap: 0.5px !important;
    }
    #ui-toolbar > .ctrl-group > button,
    #ui-toolbar > .ctrl-group > select {
        min-width: 28px !important;
        height: 17px !important;
        font-size: 9px !important;
        border-radius: 6px !important;
        padding: 0 2px !important;
    }
    #help-btn,
    #settings-btn {
        font-size: 9px !important;
        min-width: 14px !important;
        max-width: 14px !important;
        width: 14px !important;
        min-height: 14px !important;
        max-height: 14px !important;
        height: 14px !important;
        padding: 0 !important;
        line-height: 1 !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    #help-btn > *,
    #settings-btn > * {
        font-size: 12px !important;
        line-height: 1 !important;
        padding: 0 !important;
        margin: 0 !important;
        vertical-align: middle !important;
    }
    #hand-icon {
        font-size: 13px !important;
        line-height: 1 !important;
        padding: 0 !important;
    }
    #mindmap-load-input,
    #mindmap-save-input {
        width: 46px !important;
        height: 18px !important;
        font-size: 10px !important;
        padding: 0 3px !important;
    }
    #mindmap-load-btn,
    #mindmap-save-btn {
        width: 12px !important;
        height: 12px !important;
        min-width: 0 !important;
        font-size: 9px !important;
        padding: 0 !important;
    }
    #zoom-picker {
        min-width: 18px !important;
        font-size: 9px !important;
        height: 17px !important;
    }
}
@media (max-width: 700px) {
    html,
    body {
        width: 100vw !important;
        overflow-x: hidden !important;
        position: relative !important;
        left: 0 !important;
    }
    #ui-toolbar,
    #header-toggle,
    #footer-toggle {
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }
    #ui-toolbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 42dvh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        align-content: flex-start !important;
        justify-content: center !important;
        row-gap: 4px !important;
        border-radius: 0 0 14px 14px !important;
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
    }
    #help-dropdown.dropdown-content,
    #settings-dropdown.dropdown-content {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 92vw !important;
        max-width: 340px !important;
        max-height: 82dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        z-index: 100000 !important;
        box-shadow:
            0 14px 48px #191032c2,
            0 0 0 100vmax rgba(0, 0, 0, 0.55) !important;
    }
}

.image-node {
    padding: 0 !important;
    background: transparent !important;
    border: 2px solid transparent !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    position: absolute;
}
.image-node .line-color-dot,
.image-node .resize-dot,
.image-node .resize-corner,
.image-node .shape-corner {
    opacity: 0 !important;
    pointer-events: none !important;
    display: none !important;
    transition: opacity 0.12s;
}
.image-node.selected {
    border-color: #008cff !important;
    box-shadow: 0 0 0 3px #008cff33 !important;
}
.image-node.selected .line-color-dot,
.image-node.selected .resize-dot,
.image-node.selected .resize-corner,
.image-node.selected .shape-corner {
    opacity: 1 !important;
    pointer-events: auto !important;
    display: block !important;
}
.image-node img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
    user-drag: none;
    user-select: none;
    pointer-events: none;
    background: transparent !important;
}
.image-node .resize-corner {
    right: -12px !important;
    top: -12px !important;
    z-index: 101 !important;
}
.image-node .shape-corner {
    left: -12px !important;
    top: -12px !important;
    z-index: 101 !important;
}

#flowmap-ctx-menu .ctx-dropdown {
    background: #232429 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: 0 6px 24px #1e283355 !important;
    padding: 3px 0 !important;
    min-width: 190px !important;
    max-width: 250px !important;
}
#flowmap-ctx-menu .ctx-opt {
    width: 100% !important;
    border: none !important;
    background: none !important;
    font-size: 15px !important;
    color: #fafaff !important;
    text-align: left !important;
    padding: 7px 22px 7px 32px !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    transition:
        background 0.13s,
        color 0.13s !important;
}
#flowmap-ctx-menu .ctx-opt:hover,
#flowmap-ctx-menu .ctx-opt:focus {
    background: #2c284a !important;
    color: #fff !important;
}

.ctx-tooltip {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%) translateY(-8px);
    background: #232429;
    color: #fff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 2px 12px #2224;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.19s;
    border: 2px solid #8888ff;
}
.ctx-opt:focus .ctx-tooltip,
.ctx-opt:hover .ctx-tooltip {
    opacity: 1;
}

.node.square,
.node.rectangle {
    padding-left: 2px !important;
    padding-right: 2px !important;
}

.node.square .node-inner,
.node.rectangle .node-inner {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.node.square h4,
.node.square p,
.node.rectangle h4,
.node.rectangle p {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 99.5% !important;
}
