/* 居中标题 */
.container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
}
.container p {
    text-align: center;
    color: #555;
    margin-bottom: 20px;
}

.storm-diagram {
    position: relative;
    height: 400px; /* 调整高度 */
    border: 1px solid #ddd;
    margin: 20px auto;
    background-color: #fdfdfd;
    border-radius: 5px;
    padding: 20px;
    overflow: hidden;
    width: 80%; /* 调整宽度 */
    box-sizing: border-box;
}

.network-node {
    position: absolute;
    border: 1px solid #999;
    padding: 10px;
    border-radius: 5px;
    background-color: #f0f0f0;
    text-align: center;
    font-size: 0.9em;
    min-width: 100px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    z-index: 5; /* 确保节点在连接线之上 */
}

.network-node.switch {
    background-color: #e7f3fe;
    min-width: 120px;
}
.network-node.pc {
    background-color: #d2fbd2;
}

.network-node .ports span {
    display: inline-block;
    font-size: 0.7em;
    color: #666;
    margin: 5px 3px 0;
    background-color: #fff;
    padding: 1px 3px;
    border: 1px solid #ccc;
    border-radius: 2px;
}

.network-node .cpu-load {
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
    font-weight: bold;
}
.network-node .cpu-load.high {
    color: red;
}


/* 节点布局 (使用百分比) */
#switch1 { top: 20%; left: 25%; }
#switch2 { top: 20%; right: 25%; } /* 使用 right 定位 */
#pc1 { bottom: 20%; left: 10%; } /* 使用 bottom 定位 */
#pc2 { bottom: 20%; right: 10%; }

/* 连接线容器 */
.connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* 在节点下方 */
}

/* 广播消息 */
.broadcast-message {
    position: absolute;
    width: auto;
    min-width: 80px;
    height: 25px;
    padding: 0 8px;
    background-color: #ff6347; /* Tomato color for broadcast */
    color: white;
    border: 1px solid #cc4733;
    border-radius: 12px; /* 圆角 */
    font-size: 0.7em;
    text-align: center;
    line-height: 25px;
    z-index: 10;
    opacity: 0; /* 初始隐藏 */
    transition: top 0.5s linear, left 0.5s linear, opacity 0.2s ease-in-out; /* 使用 linear 模拟匀速 */
    white-space: nowrap;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    pointer-events: none; /* 防止干扰鼠标事件 */
}

/* 风暴效果 */
.storm-diagram.storm-active {
    background-color: rgba(255, 0, 0, 0.1); /* 红色背景提示 */
    animation: storm-pulse 1s infinite alternate;
}

@keyframes storm-pulse {
    from { box-shadow: 0 0 5px rgba(255,0,0,0.2); }
    to { box-shadow: 0 0 15px rgba(255,0,0,0.5); }
}


/* 信息输出 */
#storm-info {
    margin: 20px auto;
    padding: 15px;
    border: 1px solid #f0ad4e; /* Warning color */
    background-color: #fcf8e3;
    color: #8a6d3b;
    border-radius: 5px;
    min-height: 80px;
    max-height: 150px;
    overflow-y: auto;
    width: 80%; /* 与 diagram 宽度一致 */
    box-sizing: border-box;
}
#storm-info p { margin: 5px 0; }

/* 控件区域 */
.controls {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 20px;
}
.controls button {
    padding: 8px 15px;
    margin: 0 5px;
    cursor: pointer;
}
.controls label {
    font-size: 0.9em;
    color: #333;
}