body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
}
.container {
    max-width: 1100px;
    margin: 20px auto;
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}
button {
    padding: 8px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}
button:hover { background-color: #2980b9; }
button:disabled {
    background-color: #bdc3c7;
    color: #f0f0f0;
    cursor: not-allowed;
}
select#nodeCount {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    min-width: 100px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px 10px;
    padding-right: 30px;
}
select#nodeCount:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #999;
    border-color: #ddd;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 20px;
    margin-bottom: 25px;
    font-size: 0.9em;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.simulation-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}
canvas {
    border: 1px solid #ddd;
    background-color: white;
    display: block;
}
.step-info {
    flex: 1;
    min-width: 300px;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    overflow-y: auto;
    box-sizing: border-box;
}
.step-info h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #343a40;
}
.step-info p {
    margin-bottom: 10px;
}
.step-info strong {
    font-weight: 600;
    color: #495057;
    margin-right: 5px;
}
.step-info hr {
    border: none;
    border-top: 1px solid #e9ecef;
    margin: 15px 0;
}

.adjacency-matrix {
    margin-top: 25px;
    overflow-x: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.adjacency-matrix h3 {
    margin-top: 0;
    margin-bottom: 10px;
}
.adjacency-matrix p {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 15px;
}
table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 20px;
    font-size: 0.9em;
}
th, td {
    border: 1px solid #dee2e6;
    padding: 10px;
    text-align: center;
    min-width: 45px;
}
th {
    background-color: #f8f9fa;
    font-weight: 600;
}
td input.weight-input {
    width: 50px;
    text-align: center;
    padding: 6px;
    font-size: inherit;
    border: 1px solid #ccc;
    border-radius: 3px;
}
td input.weight-input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.highlight-value {
    font-weight: bold;
    color: #27ae60;
    font-size: 1.2em;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}
.final-cost {
    font-weight: bold;
    color: #27ae60;
    font-size: 1.3em;
    background-color: #e8f5e9;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 5px;
}

@media (min-width: 1001px) {
    canvas { width: 600px; height: 400px; }
    .step-info { height: 400px; }
}
@media (max-width: 1000px) {
    .simulation-area { flex-direction: column; }
    canvas { width: 100%; max-width: 600px; height: auto; }
    .step-info { height: auto; max-height: 300px; }
}
