* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #1a3c6e, #2c5282);
    color: white;
    padding: 25px 40px;
    text-align: center;
    border-bottom: 4px solid #d4a853;
}

.header h1 { font-size: 26px; letter-spacing: 4px; }
.header .subtitle { font-size: 13px; margin-top: 4px; opacity: 0.9; }

/* 控制区 */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

.control-item { display: flex; align-items: center; gap: 6px; }
.control-item label { font-weight: 600; color: #333; font-size: 13px; white-space: nowrap; }

.control-item select {
    padding: 6px 10px;
    font-size: 13px;
    border: 2px solid #ccc;
    border-radius: 5px;
    background: white;
    cursor: pointer;
}

.control-item select:focus { outline: none; border-color: #1a3c6e; }

.control-item input[type="range"] {
    width: 120px;
    height: 5px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.control-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d4a853;
    cursor: pointer;
}

.checkbox-label { cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 5px; }
.checkbox-label input { width: 14px; height: 14px; }

.tf-display { flex: 1; min-width: 200px; }
.tf-display div {
    background: white;
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 13px;
}

/* 参数说明面板 */
.param-desc-panel {
    margin: 0 25px 10px;
    padding: 12px 18px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.param-desc-panel h4 {
    color: #1a3c6e;
    font-size: 14px;
    margin-bottom: 10px;
}

.param-desc-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.param-item {
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

.param-item .param-symbol {
    font-weight: 700;
    color: #1a3c6e;
}

.param-item .param-value {
    font-weight: 600;
    color: #d97706;
}

.param-item .param-desc {
    color: #64748b;
}

/* 图表区 */
.plots-row { display: flex; gap: 15px; padding: 15px 25px; }

.plot-box {
    flex: 1;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    border-left: 4px solid #1a3c6e;
}

.plot-box h3 { color: #333; margin-bottom: 8px; font-size: 14px; }

.plot-box canvas {
    width: 100%;
    height: auto;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* 奈奎斯特图控件 */
.nyquist-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.range-group {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #555;
}

.range-group label { font-weight: 500; margin-left: 8px; }

.range-group input[type="number"] {
    width: 60px;
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

.range-group input[type="number"]:focus {
    outline: none;
    border-color: #1a3c6e;
}

.range-group span { color: #999; }

/* 指标卡片 */
.metrics-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 25px;
}

.metric-card {
    flex: 1;
    min-width: 130px;
    background: #f5f7fa;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.metric-label { font-size: 11px; color: #666; margin-bottom: 3px; }
.metric-value { font-size: 15px; font-weight: bold; color: #1a3c6e; }
.metric-value.green { color: #16a34a; }
.metric-value.red { color: #dc2626; }
.metric-value.orange { color: #d97706; }
.stability-card { flex: 2; min-width: 180px; }

/* 时域面板 */
.td-panel {
    margin: 12px 25px;
    padding: 18px;
    background: #f0f4ff;
    border: 2px solid #dbeafe;
    border-radius: 10px;
}

.td-panel.unstable { background: #fef2f2; border-color: #fca5a5; }
.td-panel h3 { color: #1a3c6e; margin-bottom: 12px; font-size: 15px; }

.td-content { display: flex; gap: 20px; margin-bottom: 12px; }
.td-left { flex: 0 0 35%; }
.td-right { flex: 1; }

.td-left h4, .td-right h4 {
    color: #333; font-size: 14px; margin-bottom: 8px;
}

.td-box {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 14px;
    min-height: 40px;
}

#pzCanvas {
    width: 100%;
    max-width: 350px;
    height: auto;
    aspect-ratio: 1;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.td-metric-item {
    display: inline-block;
    background: white;
    padding: 8px 12px;
    border-radius: 5px;
    margin: 4px;
    font-size: 14px;
}

.td-metric-label { color: #666; font-size: 12px; }
.td-metric-val { font-weight: 600; color: #1a3c6e; }

.td-curve canvas {
    width: 100%;
    height: auto;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* 页脚 */
.footer { padding: 18px 40px 22px; text-align: center; }

.footer-divider {
    height: 3px;
    background: linear-gradient(90deg, transparent, #1a3c6e 20%, #d4a853 50%, #1a3c6e 80%, transparent);
    margin-bottom: 12px;
}

.footer-text {
    color: #1a3c6e;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 4px;
}

@media (max-width: 900px) {
    .plots-row, .td-content { flex-direction: column; }
    .td-left, .td-right { flex: 1; }
    .control-panel { flex-direction: column; }
    .nyquist-controls { flex-direction: column; align-items: flex-start; }
}

mjx-container { display: inline-block !important; }
