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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    height: 100vh;
}

/* 左侧菜单样式 */
.sidebar {
    width: 200px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-right: 20px;
    height: fit-content;
}

.menu-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e1e1e1;
    text-align: center;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: none;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    color: #555;
}

.menu-item:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.menu-item.active {
    background: #4a90e2;
    color: white;
    font-weight: bold;
}

.container {
    flex: 1;
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 100vh;
    /* 限制最大高度为视口高度 */
    overflow-y: auto;
    /* 超出时滚动 */
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 24px;
}

.calculator {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fafafa;
}

.formula {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    padding: 10px;
    background: #e8f4fd;
    border-radius: 5px;
    color: #2c3e50;
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
}

.input-field {
    flex: 1;
    min-width: 150px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

input,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.button-group {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    justify-content: center;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.calculate-btn {
    background: #4a90e2;
    color: white;
}

.calculate-btn:hover {
    background: #357ae8;
}

.clear-btn {
    background: #e74c3c;
    color: white;
}

.clear-btn:hover {
    background: #c0392b;
}

.error {
    color: #e74c3c;
    font-size: 14px;
    margin: 10px 0;
    min-height: 20px;
}

.instruction {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
    line-height: 1.5;
}

.separator {
    height: 1px;
    background: #e1e1e1;
    margin: 20px 0;
}

.footer {
    text-align: center;
    font-size: 12px;
    color: #888;
    margin-top: 20px;
    font-style: italic;
}

/* 隐藏所有计算器 */
.calculator-container {
    display: none;
}

/* 显示当前激活的计算器 */
.calculator-container.active {
    display: block;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .input-field {
        min-width: 100%;
    }
}