
/* 全局样式设置 */
body {
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', sans-serif; /* 使用易读性高的字体 */
  background: linear-gradient(135deg, #4A00E0, #8E2DE2); /* 主色调渐变背景 */
  color: #F0F0F0; /* 浅灰色用于文本 */
  line-height: 1.6;
  font-size: 16px; /* 正文字号 */
  transition: background 0.5s ease, color 0.5s ease;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(74, 0, 224, 0.8); /* 半透明背景 */
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 15px 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.navbar a {
  color: #F0F0F0;
  text-decoration: none;
  font-size: 18px;
  transition: color 0.3s ease;
}

.navbar a:hover {
  color: #FF6F61; /* 点缀色用于悬停效果 */
}

/* 主要内容区域 */
.main {
  padding: 100px 20px 50px 20px; /* 顶部留出导航栏空间 */
  max-width: 1200px;
  margin: 0 auto;
}

/* 章节导航 */
.chapter-nav {
  position: fixed;
  top: 80px;
  right: 20px;
  background: rgba(255, 111, 97, 0.8); /* 点缀色背景 */
  padding: 10px 15px;
  border-radius: 10px;
}

.chapter-nav a {
  display: block;
  color: #FFFFFF;
  margin: 5px 0;
  text-decoration: none;
  font-size: 16px;
}

.chapter-nav a:hover {
  background: rgba(255, 111, 97, 0.6);
  border-radius: 5px;
}

/* 提示信息样式 */
.highlight {
  background: rgba(255, 111, 97, 0.2);
  padding: 10px;
  border-left: 5px solid #FF6F61;
  margin-bottom: 20px;
  font-size: 20px;
  text-align: center;
}

/* 文章内容样式 */
article h2 {
  font-family: 'Montserrat', sans-serif; /* 标题字体 */
  font-size: 24px;
  margin-top: 40px;
  margin-bottom: 20px;
  color: #FFFFFF;
}

article h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  margin-top: 30px;
  margin-bottom: 15px;
  color: #FF6F61; /* 强调色 */
}

article p {
  font-size: 17px;
  color: #F0F0F0;
  margin-bottom: 20px;
}

/* 图片样式 */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.image-grid img {
  width: 100%;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-grid img:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* 代码块样式 */
.code-block {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 20px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  color: #FF6F61;
  margin-bottom: 30px;
}

.code-block code {
  display: block;
  white-space: pre;
}

/* 按钮样式 */
.button {
  background: linear-gradient(45deg, #FF6F61, #F06595);
  border: none;
  border-radius: 50px;
  color: #FFFFFF;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}

.button:hover {
  background: linear-gradient(45deg, #F06595, #FF6F61);
  transform: scale(1.05);
}

/* 动态渐变动画 */
.dynamic-gradient {
  background: linear-gradient(270deg, #FF6B6B, #F06595, #A044FF, #6A3093);
  background-size: 800% 800%;
  animation: dynamicGradient 20s ease infinite;
}

@keyframes dynamicGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

  .chapter-nav {
    position: static;
    margin: 20px 0;
  }

  .image-grid {
    grid-template-columns: 1fr;
  }
}

/* 过渡动画 */
@keyframes gradientAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 黑暗模式 */
body.dark-mode {
  background: #121212;
  color: #E0E0E0;
}

body.dark-mode .navbar {
  background: rgba(74, 0, 224, 0.9);
}

body.dark-mode .chapter-nav {
  background: rgba(255, 111, 97, 0.9);
}

body.dark-mode .button {
  background: linear-gradient(45deg, #F06595, #FF6B6B);
}

body.dark-mode .button:hover {
  background: linear-gradient(45deg, #FF6B6B, #F06595);
}

.toggle-switch {
  position: absolute;
  top: 20px;
  right: 100px;
}

.toggle-switch input {
  display: none;
}

.toggle-switch label {
  cursor: pointer;
  width: 50px;
  height: 25px;
  background: #ccc;
  border-radius: 25px;
  position: relative;
  transition: background 0.3s ease;
}

.toggle-switch label::after {
  content: '';
  width: 21px;
  height: 21px;
  background: #FFFFFF;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
}

.toggle-switch input:checked + label {
  background: #6A3093;
}

.toggle-switch input:checked + label::after {
  transform: translateX(25px);
}

