
/* 整体页面样式 */
body {
    /* 使用深蓝到紫色的线性渐变作为背景 */
    background: linear-gradient(135deg, #0d47a1, #7b1fa2);
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    /* 设置页面的响应式布局 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    z-index: 1000;
    transition: background 0.3s;
}
.navbar:hover {
    background: rgba(0, 0, 0, 0.7);
}
.navbar .logo {
    font-size: 1.8em;
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
}
.navbar ul {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}
.navbar ul li a {
    color: #00e676;
    text-decoration: none;
    font-size: 1.1em;
    transition: color 0.3s, transform 0.3s;
}
.navbar ul li a:hover {
    color: #ff4081;
    transform: scale(1.1);
}

/* 容器样式 */
.container {
    flex: 1;
    padding: 100px 20px 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 章节导航样式 */
.chapter-nav {
    position: fixed;
    right: 20px;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chapter-nav a {
    background-color: #ff4081;
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    transition: background-color 0.3s, transform 0.3s;
}
.chapter-nav a:hover {
    background-color: #00e676;
    transform: translateX(-5px);
}

/* 文章样式 */
article {
    display: flex;
    flex-direction: column;
    gap: 40px;
}
article h2 {
    font-size: 2em;
    color: #ffe082;
    border-bottom: 2px solid #00e676;
    padding-bottom: 10px;
    position: relative;
}
article h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 50px;
    height: 2px;
    background: #ff4081;
}
article section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, background 0.3s;
}
article section:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.15);
}

article p {
    font-size: 1.1em;
    line-height: 1.6;
    margin: 15px 0;
}

/* 图片样式 */
article img {
    width: 100%;
    max-width: 320px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}
article img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

/* 代码块样式 */
pre {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin: 20px 0;
}
pre code {
    color: #00e676;
    font-size: 1em;
}
pre code::before {
    content: "〈code〉";
    color: #ff4081;
}
pre code::after {
    content: "〈/code〉";
    color: #ff4081;
}

/* 按钮样式 */
.btn {
    background-color: #00e676;
    border: none;
    padding: 15px 30px;
    color: #ffffff;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.3s, background-color 0.3s;
    font-size: 1em;
}
.btn:hover {
    transform: scale(1.05);
    background-color: #00c853;
}

/* 代码示例块的样式 */
.code-example {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-left: 5px solid #ff4081;
    margin: 20px 0;
    font-family: 'Courier New', Courier, monospace;
    position: relative;
}
.code-example::before {
    content: "CSS3 代码示例";
    position: absolute;
    top: -20px;
    left: 0;
    background: #0d47a1;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .navbar ul {
        flex-direction: column;
        background: rgba(0, 0, 0, 0.8);
        position: fixed;
        top: 60px;
        right: -100%;
        width: 200px;
        height: calc(100% - 60px);
        transition: right 0.3s;
    }
    .navbar ul.active {
        right: 0;
    }
    .chapter-nav {
        display: none;
    }
}
@media (max-width: 480px) {
    body {
        padding: 80px 10px 20px 10px;
    }
    article h2 {
        font-size: 1.5em;
    }
    .navbar .logo {
        font-size: 1.2em;
    }
    .navbar ul li a {
        font-size: 0.9em;
    }
    .chapter-nav a {
        font-size: 0.8em;
        padding: 8px 12px;
    }
}

