body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

svg {
    display: block;
    width: 100%;
    height: 100%;
}

.links line {
    stroke-opacity: 0.6;
}

text {
    pointer-events: none;
    font-family: sans-serif;
}

.legend {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px;
    font-family: sans-serif;
    font-size: clamp(12px, 1.5vw, 14px);
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    max-height: 80vh;
    overflow-y: auto;
}

.legend h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 16px;
}

.legend p {
    margin: 5px 0;
}

.stats-section {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.stats-section h3 {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stats-section h3::before {
    content: '▼';
    font-size: 0.8em;
}

.stats-section.collapsed h3::before {
    content: '▶';
}

.stats-section.collapsed .section-content {
    display: none;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: sans-serif;
    font-size: clamp(16px, 2vw, 20px);
    color: #333;
}

.instructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: sans-serif;
    font-size: clamp(16px, 2vw, 20px);
    color: #333;
    text-align: center;
    width: 90%;
    max-width: 600px;
}

.node-details {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: min(400px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-family: sans-serif;
    display: none;
    font-size: clamp(12px, 1.5vw, 14px);
    user-select: none;
}

.drag-handle {
    padding: 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

#node-details-content {
    padding: 15px;
}

.close-button {
    cursor: pointer;
    font-size: clamp(16px, 2vw, 20px);
}

#visualize-propagation {
    margin: 0 15px 15px 15px;
    width: calc(100% - 30px);
}

@media (max-width: 768px) {
    .legend {
        font-size: 12px;
    }

    .node-details {
        width: 90vw;
        right: 50%;
        transform: translateX(50%);
    }
}

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    font-size: inherit;
}

.stats-table th,
.stats-table td {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid #eee;
}

.stats-table th {
    font-weight: bold;
    background-color: #f5f5f5;
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.propagation-timer {
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 14px;
}

.propagation-timer button {
    display: block;
    width: 100%;
    font-family: inherit;
    cursor: pointer;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.propagation-timer button:hover {
    background: #e5e5e5;
}

.timer-text {
    margin-bottom: 5px;
}
