
/* 定义CSS变量，确保色彩统一且易于维护 */
:root {
  --primary-green: #2E7D32; /* 深绿色，象征生态友好 */
  --primary-brown: #795548; /* 棕色，传递稳定与自然 */
  --secondary-blue: #03A9F4; /* 蓝色，突出科技感 */
  --secondary-gray: #757575; /* 灰色，提升专业感 */
  --accent-color: #FF5722; /* 点缀色，增加视觉焦点 */
  --background-gradient: linear-gradient(135deg, var(--primary-green), var(--primary-brown));
  --font-primary: 'Arial, sans-serif'; /* 正文字体 */
  --font-secondary: 'Brush Script MT, cursive'; /* 标题字体 */
}

/* 全局样式 */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  background: var(--background-gradient);
  color: var(--secondary-gray);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.5s ease;
}

/* 导航栏样式 */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--primary-brown);
  padding: 15px 30px;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

.navbar ul li {
  position: relative;
}

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

.navbar ul li a:hover {
  color: var(--accent-color);
}

/* 章节导航样式 */
.chapter-nav {
  position: fixed;
  top: 70px;
  left: 20px;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.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: var(--primary-green);
  font-size: 14px;
  transition: color 0.3s ease;
}

.chapter-nav ul li a:hover {
  color: var(--accent-color);
}

/* 主内容区样式 */
.main-content {
  max-width: 1200px;
  margin: 100px auto 50px auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.main-content h2, .main-content h3, .main-content h4 {
  font-family: var(--font-secondary);
  color: var(--primary-green);
  margin-top: 40px;
  margin-bottom: 20px;
}

.main-content h3 {
  font-size: 18px;
}

.main-content p {
  font-size: 16px;
  margin-bottom: 20px;
}

.main-content a {
  color: var(--secondary-blue);
  text-decoration: none;
  transition: color 0.3s ease;
}

.main-content a:hover {
  color: var(--primary-green);
}

.main-content pre {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.main-content code {
  font-family: 'Courier New', Courier, monospace;
  color: #d63384;
}

/* 表格样式 */
.main-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.main-content table, .main-content th, .main-content td {
  border: 1px solid #ddd;
}

.main-content th, .main-content td {
  padding: 12px;
  text-align: left;
}

.main-content th {
  background-color: var(--secondary-blue);
  color: white;
}

.main-content tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* 列表样式 */
.main-content ul, .main-content ol {
  margin-left: 20px;
  margin-bottom: 20px;
}

.main-content li {
  margin-bottom: 10px;
}

/* 图片装饰样式 */
.image-decor {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin: 20px 0;
}

.image-decor:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* 按钮样式 */
button {
  background-color: var(--secondary-blue);
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
  background-color: var(--primary-green);
  transform: scale(1.05);
}

/* 代码块特殊样式 */
.code-example {
  background: #282c34;
  color: #61dafb;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  margin-bottom: 20px;
}

/* 背景和特效 */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://images.gptkong.com/demo/sample1.png'), url('https://images.gptkong.com/demo/sample2.png');
  background-repeat: no-repeat, no-repeat;
  background-size: 200px 200px, 150px 150px;
  opacity: 0.1;
  animation: floatBackground 60s linear infinite;
}

@keyframes floatBackground {
  0% { transform: translate(0, 0); }
  50% { transform: translate(50px, 50px); }
  100% { transform: translate(0, 0); }
}

/* 关键帧动画 */
@keyframes fillBar {
  to { width: 80%; }
}

@keyframes floatLeaf {
  0% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(100px) rotate(360deg); }
  100% { transform: translateX(0) rotate(720deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .chapter-nav {
    display: none;
  }
  
  .main-content {
    margin: 80px 10px 20px 10px;
  }
  
  .image-decor {
    max-width: 100%;
  }
}

