#skills-graph {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    max-height: 800px;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background: #fafafa;
    overflow: hidden;
    position: relative;
    /* Ensure the container creates a new stacking context */
    isolation: isolate;
}

#skills-graph .graph-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.control-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 10px;
    margin: 2px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s, transform 0.1s;
}

.control-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

.node {
    stroke: #fff;
    stroke-width: 1.5px;
    cursor: pointer;
    transition: r 0.2s, stroke-width 0.2s;
}

.node:hover {
    stroke: #f39c12;
    stroke-width: 2px;
}

.link {
    stroke: #999;
    stroke-opacity: 0.4;
    transition: stroke-opacity 0.2s, stroke-width 0.2s;
}

.label {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    fill: #2c3e50;
    pointer-events: none;
    text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff;
    text-anchor: middle;
    dominant-baseline: middle;
    user-select: none;
}

.skills-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #skills-graph {
        height: 60vh;
        min-height: 350px;
    }

    .graph-controls {
        top: 5px;
        right: 5px;
        padding: 6px;
    }

    .control-btn {
        padding: 4px 8px;
        font-size: 10px;
        margin: 1px;
    }

    .skills-tooltip {
        font-size: 11px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    #skills-graph {
        height: 50vh;
        min-height: 300px;
    }

    .graph-controls {
        padding: 4px;
    }

    .control-btn {
        padding: 3px 6px;
        font-size: 9px;
    }

    .skills-tooltip {
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .node,
    .link,
    .control-btn,
    .skills-tooltip {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #skills-graph {
        border: 2px solid #000;
    }
    
    .node {
        stroke: #000;
        stroke-width: 2px;
    }
    
    .label {
        text-shadow: none;
        font-weight: 900;
    }
}