
/* 全局样式设置 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif; /* 使用现代无衬线字体 */
    font-size: 16px; /* 正文字号 */
    color: #ffffff; /* 文字颜色为白色 */
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e); /* 背景渐变色 */
    animation: backgroundAnimation 15s infinite alternate; /* 背景动画效果 */
}

/* 背景动画关键帧 */
@keyframes backgroundAnimation {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6); /* 半透明背景 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    transition: background 0.5s ease;
    z-index: 1000;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.9); /* 滚动后背景加深 */
}

.navbar .logo {
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
}

.navbar ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.navbar ul li {
    margin-left: 20px;
}

.navbar ul li a {
    text-decoration: none;
    color: #ffffff;
    font-size: 16px;
    transition: color 0.3s ease;
}

.navbar ul li a:hover {
    color: #00f; /* 悬停时颜色变化 */
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    transform: translateX(-100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    z-index: 999;
}

.sidebar.open {
    transform: translateX(0);
    opacity: 1;
}

.sidebar ul {
    list-style: none;
    padding: 50px 20px;
}

.sidebar ul li {
    margin-bottom: 20px;
}

.sidebar ul li a {
    text-decoration: none;
    color: #ffffff;
    font-size: 18px;
    transition: color 0.3s ease;
}

.sidebar ul li a:hover {
    color: #0f0; /* 悬停时颜色变化 */
}

/* 主要内容区域样式 */
.main-content {
    padding: 100px 20px 20px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content h2, .main-content h3, .main-content h4 {
    color: #ffffff;
    margin-bottom: 20px;
}

.main-content p {
    line-height: 1.6;
    margin-bottom: 20px;
}

.main-content pre {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.main-content code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
}

/* 模块化布局样式 */
.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
}

.module {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    margin: 10px;
    flex: 1 1 300px;
    transition: transform 0.3s ease;
}

.module:hover {
    transform: scale(1.05); /* 悬停时放大效果 */
}

/* 图片样式 */
.decorative-image {
    width: 320px;
    height: 320px;
    border-radius: 15px; /* 圆角 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* 阴影效果 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.decorative-image:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.7);
    border: 2px solid #00f; /* 精致边框 */
}

/* 按钮样式 */
.button {
    background: #ff4081;
    border: none;
    padding: 15px 30px;
    color: #fff;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    text-decoration: none;
}

.button:hover {
    background: #e91e63;
    transform: scale(1.05);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .module {
        flex: 1 1 100%;
    }

    .navbar ul {
        display: none; /* 小屏幕隐藏导航项 */
    }

    .sidebar {
        width: 200px;
    }

    .decorative-image {
        width: 100%;
        height: auto;
    }
}

/* 章节导航样式 */
.chapter-nav {
    position: fixed;
    right: 20px;
    top: 100px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
}

.chapter-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-nav ul li {
    margin-bottom: 10px;
}

.chapter-nav ul li a {
    text-decoration: none;
    color: #ffffff;
    font-size: 14px;
    transition: color 0.3s ease;
}

.chapter-nav ul li a:hover {
    color: #0f0;
}

