#tree-container {
    overflow: auto;
    position: relative;
}

.node circle {
    fill: #fff;
    stroke: steelblue;
    stroke-width: 1.5px;
    cursor: pointer;
}

.node text {
    font: 12px sans-serif;
    cursor: pointer;
}

.link {
    fill: none;
    stroke: #ccc;
    stroke-width: 1.5px;
}

.node.selected circle {
    fill: orange;
    stroke: darkorange;
}

.node.selected text {
    font-weight: normal;
    fill: darkorange;
}

/* Keep selected tip labels readable: color indicates selection without bolding. */
#tree-container .node-selected text,
#tree-container .node.node-selected text,
#tree-container .node.selected text,
#tree-container text.phylotree-node-text.node-selected {
    font-weight: 400 !important;
    stroke: none !important;
    stroke-width: 0 !important;
    paint-order: normal !important;
}

/* Phylotree specific overrides if needed */
.phylotree-node circle {
    fill: #999;
}

.node-support-value {
    font-family: sans-serif;
    font-weight: 500;
    fill: #c0392b;
    /* Distinct Red for visibility */
    pointer-events: none;
    paint-order: stroke;
    stroke: #ffffff;
    /* White halo for light mode */
    stroke-width: 3px;
    stroke-linejoin: round;
}

.dark .node-support-value {
    fill: #ff6b6b;
    /* Brighter Red for dark mode */
    stroke: #000000;
    /* Black halo for dark mode */
}

#tree-container .branch {
    stroke: #000000;
    fill: none;
}

#tree-container .node text,
#tree-container .phylotree-node-text,
#tree-container text.phylotree-node-text {
    fill: #000000;
    font-weight: 400;
    stroke: none;
    stroke-width: 0;
    paint-order: normal;
}

/* Dark mode support for tree labels */
/* Dark mode support - Scoped to avoid global conflicts */
/* We rely on the .dark class (Tailwind strategy) rather than raw media queries 
   to ensure the toggle works correctly regardless of OS preference. */

/* Combined rules for dark mode under .dark class */
.dark #tree-container .node text,
.dark #tree-container .phylotree-node-text,
.dark #tree-container text.phylotree-node-text {
    fill: #ffffff !important;
}

.dark #tree-container .tree-scale-bar text {
    fill: #ffffff !important;
}

.dark #tree-container .tree-scale-bar line,
.dark #tree-container .tree-scale-bar path {
    stroke: #ffffff !important;
}

.dark #tree-container .branch {
    stroke: #ccc !important;
    /* Brighter than #999 for better visibility in dark mode */
}



/* Also support explicit dark class on container or parent */
/* Also support explicit dark class on container or parent */
.dark #tree-container .node text,
.dark #tree-container .phylotree-node-text,
.dark #tree-container text.phylotree-node-text {
    fill: #ffffff !important;
}

.dark #tree-container .tree-scale-bar text {
    fill: #ffffff !important;
}

.dark #tree-container .tree-scale-bar line,
.dark #tree-container .tree-scale-bar path {
    stroke: #ffffff !important;
}

.dark #tree-container .branch {
    stroke: #ccc !important;
    /* Brighter for dark mode */
}

/* Active state for toggle buttons (e.g., midpoint rooting) */
#btn-midpoint.active {
    background-color: #6366f1 !important;
    /* indigo-500 */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#btn-midpoint.active:hover {
    background-color: #4f46e5 !important;
    /* indigo-600 */
}
