.hub-diagram {
    position: relative;
    width: 600px; /* 可以根据需要调整 */
    max-width: 100%; /* 响应式 */
    height: 400px;
    border: 1px solid #ccc;
    margin: 20px auto; /* 确保图表本身在容器内居中 */
    background-color: #f9f9f9;
    overflow: hidden; /* Hide overflowing elements */
}

.network-node {
    position: absolute;
    border: 1px solid #999;
    padding: 10px;
    background-color: #fff;
    text-align: center;
    border-radius: 5px;
    min-width: 80px; /* Ensure minimum width */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.network-node strong {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.hub {
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #e0f7fa; /* Light blue for hub */
    border-color: #00acc1;
}

.hub .ports {
    font-size: 10px;
    color: #555;
    margin-top: 5px;
    display: flex;
    justify-content: space-around;
}

.pc {
    bottom: 15%;
    background-color: #e8f5e9; /* Light green for PCs */
    border-color: #4caf50;
}

#pc1 { left: 10%; transform: translateX(-50%); }
#pc2 { left: 30%; transform: translateX(-50%); }
#pc3 { left: 70%; transform: translateX(-50%); }
#pc4 { left: 90%; transform: translateX(-50%); }


.connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through */
}

.data-packet {
    position: absolute;
    background-color: #ffeb3b; /* Yellow packet */
    border: 1px solid #fbc02d;
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 3px;
    opacity: 0; /* Initially hidden */
    transition: top 1s linear, left 1s linear, opacity 0.2s ease-in-out;
    z-index: 10;
    pointer-events: none;
}

.collision-effect {
    position: absolute;
    font-size: 24px;
    color: red;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 0 5px white;
}

/* 确保 hub-active 状态的样式 */
.hub.hub-active {
    border-color: #ff9800; /* 橙色边框表示活动 */
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}


.controls {
    text-align: center; /* 确保控件内的元素居中 */
    margin-top: 20px;
    margin-bottom: 20px; /* 增加底部间距 */
}

.controls label,
.controls select,
.controls button {
    margin: 5px 10px; /* 调整间距 */
    padding: 8px 12px; /* 统一按钮/选择框大小 */
    font-size: 14px;
}

#hub-info {
    margin: 20px auto; /* 信息框居中 */
    padding: 15px;
    border: 1px solid #eee;
    background-color: #f8f8f8;
    height: 200px; /* 增加高度以容纳更多信息 */
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    text-align: left; /* 信息文本左对齐更易读 */
    max-width: 600px; /* 限制最大宽度 */
}

#hub-info p {
    margin: 8px 0; /* 增加段落间距 */
    border-bottom: 1px dashed #ddd; /* 分隔条目 */
    padding-bottom: 5px;
}
#hub-info p:last-child {
    border-bottom: none; /* 最后一个条目无分隔线 */
}