* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
}

.visualizer {
    width: min(900px, 90%);
    margin: 50px auto;
}

h1,h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.graph-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 2px;
    overflow: hidden;
}

#graph {
    width: 100%;
    display: block;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-top: 20px;
}

.controls input {
    width: 80px;
    padding: 8px;
}

button {
    padding: 9px 16px;
    cursor: pointer;
}

.results {
    margin-top: 30px;
}

#rank-results {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    min-width: 250px;

    background: white;
    padding: 14px 18px;
    border: 1px solid #ddd;
    border-radius: 2px;
}

.node {
    fill: white;
    stroke: #222;
    stroke-width: 2px;
}

.node-label {
    font-size: 18px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.link {
    fill: none;
    stroke: #222;
    stroke-width: 2px;
}

.arrow-head {
    fill: #222;
}

#rank-results p {
    margin: 6px 0;
}

#graph {
    touch-action: none;
    user-select: none;
}

.node-group {
    cursor: crosshair;
}

.node-group:hover .node {
    fill: #f2f2f2;
}

.link {
    pointer-events: none;
}

.preview-link {
    fill: none;
    stroke: #777;
    stroke-width: 2px;
    stroke-dasharray: 6 5;
    pointer-events: none;
}

#graph.add-node-mode {
    cursor: crosshair;
}

#add-node-button.active {
    background: #222;
    color: white;
}

#interaction-help {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

#rank-results p {
    margin: 6px 0;
}