body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 20px;
}
.container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
h1, h2, h3 {
    color: #343a40;
}
h1 {
    text-align: center;
    margin-bottom: 10px;
}
h2 {
    font-size: 1.4em;
    margin-top: 30px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}
h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
}
.description {
    text-align: center;
    color: #6c757d;
    margin-bottom: 30px;
    font-size: 1.1em;
}
.simulation-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}
.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.control-btn {
    padding: 8px 18px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.3s;
}
.control-btn:hover { background-color: #0056b3; }
#reset-btn { background-color: #dc3545; }
#reset-btn:hover { background-color: #c82333; }
select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* 网络拓扑样式 */
.network-topology {
    margin-bottom: 30px;
}
.topology-container {
    position: relative;
    height: 350px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    padding: 20px;
}
.router {
    position: absolute;
    width: 120px;
    height: 80px;
    background-color: #e9ecef;
    border: 2px solid #495057;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.router-a { top: 50px; left: 100px; }
.router-b { top: 50px; left: 50%; transform: translateX(-50%); }
.router-c { top: 50px; right: 100px; }
.router-label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #343a40;
}
.router-interfaces {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.8em;
    color: #6c757d;
}
.network {
    position: absolute;
    width: 140px;
    height: 60px;
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.network-1 { bottom: 50px; left: 80px; }
.network-2 { bottom: 220px; left: 25%; } /* 从35%改为25%，向左移动 */
.network-3 { bottom: 220px; right: 25%; } /* 从35%改为25%，向右移动 */
.network-4 { bottom: 50px; right: 80px; }
.network-label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #0c5460;
}
.network-address {
    font-size: 0.85em;
    color: #155724;
}
.connection {
    position: absolute;
    background-color: #adb5bd;
    z-index: 0;
}
#conn-a1 { width: 2px; height: 150px; top: 130px; left: 130px; }
#conn-a2 { width: 320px; height: 2px; top: 90px; left: 220px; }
#conn-b1 { width: 2px; height: 0px; top: 130px; left: 50%; transform: translateX(-50%); }
#conn-b2 { width: 320px; height: 2px; top: 90px; right: 220px; }
#conn-c1 { width: 2px; height: 150px; top: 130px; right: 130px; }
#conn-c2 { width: 0; height: 0; display: none; } /* 隐藏多余的连接线 */
#conn-c2 { width: 150px; height: 2px; top: 180px; right: 35%; }
.packet {
    position: absolute;
    width: 30px;
    height: 20px;
    background-color: #ffc107;
    border: 1px solid #e0a800;
    border-radius: 4px;
    color: #343a40;
    font-weight: bold;
    font-size: 0.7em;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
    text-align: center;
}

/* 路由表样式 */
.routing-tables {
    margin-bottom: 30px;
}
.tables-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}
.table-wrapper {
    flex: 1;
    min-width: 300px;
}
.routing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    table-layout: fixed;
}
.routing-table th, .routing-table td {
    border: 1px solid #dee2e6;
    padding: 6px 8px;
    text-align: center;
    word-wrap: break-word;
    overflow: hidden;
}
.routing-table th {
    background-color: #e9ecef;
    color: #495057;
}
.routing-table tr:nth-child(even) {
    background-color: #f8f9fa;
}
.highlight {
    background-color: #fff3cd !important;
    transition: background-color 0.5s;
}
.new-entry {
    background-color: #d4edda !important;
    transition: background-color 0.5s;
}

/* 信息面板和说明卡片 */
.info-panel, .explanation-card {
    margin-top: 30px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
}
.panel-title, .card-title {
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.1em;
    color: #495057;
}
.panel-content, .card-content {
    color: #6c757d;
    font-size: 1em;
    max-height: 300px;
    overflow-y: auto;
}
.panel-content p {
    margin: 5px 0;
}
.card-content ul {
    padding-left: 20px;
    margin: 0;
}
.card-content li {
    margin-bottom: 10px;
}
.card-content strong {
    color: #343a40;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .tables-container {
        flex-direction: column;
    }
    .table-wrapper {
        width: 100%;
    }
}