/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* 深色模式 */
body.dark-mode {
  background-color: #0a0a1a;
  color: #fff;
}

body.dark-mode header {
  background: linear-gradient(135deg, #0f2027 0%, #1a365d 100%);
  backdrop-filter: blur(10px);
}

body.dark-mode .category-section {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

body.dark-mode .article-card {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

body.dark-mode .article-card h3 a {
  color: #fff;
}

body.dark-mode .article-meta {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

body.dark-mode .meta-item {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

body.dark-mode .article-excerpt {
  color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .category-title {
  color: #fff;
  border-bottom: 3px solid rgba(102, 126, 234, 0.8);
}

body.dark-mode .category-title::after {
  background-color: rgba(118, 75, 162, 0.8);
}

body.dark-mode .category-title a {
  color: #fff;
}

body.dark-mode footer {
  background: linear-gradient(135deg, #0f2027 0%, #1a365d 100%);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* 浅色模式 */
body.light-mode {
  background-color: #e6f0ff;
  color: #333;
}

body.light-mode header {
  background: linear-gradient(135deg, #0f2027 0%, #1a365d 100%);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

body.light-mode .category-section {
  background-color: white;
  border: 1px solid #e9ecef;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

body.light-mode .article-card {
  background-color: white;
  border: 1px solid #e9ecef;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

body.light-mode .article-card h3 a {
  color: #3498db;
}

body.light-mode .article-meta {
  border-bottom: 1px solid #e9ecef;
}

body.light-mode .meta-item {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  color: #6c757d;
}

body.light-mode .article-excerpt {
  color: #6c757d;
}

body.light-mode .category-title {
  color: #2c3e50;
  border-bottom: 3px solid #667eea;
}

body.light-mode .category-title::after {
  background-color: #764ba2;
}

body.light-mode .category-title a {
  color: #2c3e50;
}

body.light-mode footer {
  background: linear-gradient(135deg, #0f2027 0%, #1a365d 100%);
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 -4px 6px rgba(0,0,0,0.1);
}

/* 烟花动画 */
.fireworks {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.firework {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: explode 2s ease-out forwards;
}

@keyframes explode {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* 星星动画 */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.star {
  position: absolute;
  background-color: #fff;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* 太阳动画 */
.sun {
  position: fixed;
  top: 200px;
  right: 50px;
  width: 100px;
  height: 100px;
  background-color: #ffd93d;
  border-radius: 50%;
  box-shadow: 0 0 50px #ffd93d, 0 0 100px #ffd93d;
  animation: sunRotate 20s linear infinite;
  z-index: -1;
  display: none;
}

@keyframes sunRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}



/* 白云动画 */
.clouds {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.cloud {
  position: absolute;
  left: -100px;
  background-color: #ffffff;
  border-radius: 50px;
  animation: float 30s linear forwards;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background-color: #ffffff;
  border-radius: 50%;
}

.cloud::before {
  width: 60px;
  height: 60px;
  top: -30px;
  left: 10px;
}

.cloud::after {
  width: 80px;
  height: 80px;
  top: -40px;
  right: 10px;
}

@keyframes float {
  from {
    transform: translateX(-100px) translateY(0);
  }
  25% {
    transform: translateX(25vw) translateY(-20px);
  }
  50% {
    transform: translateX(50vw) translateY(0);
  }
  75% {
    transform: translateX(75vw) translateY(20px);
  }
  to {
    transform: translateX(110vw) translateY(0);
  }
}

/* 模式切换悬浮按钮 */
.mode-toggle {
  position: fixed;
  top: 20px;
  right: -30px;
  z-index: 1000;
  transition: right 0.3s ease;
}

.mode-toggle:hover {
  right: 20px;
}

.toggle-btn {
  width: 60px;
  height: 60px;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #e9ecef;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.toggle-btn.dark-mode {
  background-color: #333;
  border-color: #555;
}

.icon {
  font-size: 24px;
  position: absolute;
  transition: all 0.3s ease;
}

.sun-icon {
  opacity: 1;
  transform: translateX(0);
}

.moon-icon {
  opacity: 0;
  transform: translateX(20px);
}

.toggle-btn.dark-mode .sun-icon {
  opacity: 0;
  transform: translateX(-20px);
}

.toggle-btn.dark-mode .moon-icon {
  opacity: 1;
  transform: translateX(0);
}

/* 头部样式 */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

nav {
  margin-top: 10px;
}

nav a {
  color: white;
  text-decoration: none;
  margin: 0 15px;
  font-size: 1.1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  padding: 8px 12px;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

nav a:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 12px;
  right: 12px;
  width: calc(100% - 24px);
  height: 2px;
  background-color: #667eea;
  transition: width 0.3s ease, background-color 0.3s ease;
  transform: scaleX(0);
  transform-origin: center;
}

nav a:hover::after {
  transform: scaleX(1);
  background-color: #fff;
}

/* 活动导航链接 */
nav a.active {
  color: #fff;
  font-weight: 600;
  background-color: rgba(102, 126, 234, 0.8);
  border: 1px solid rgba(102, 126, 234, 0.9);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

nav a.active::after {
  transform: scaleX(1);
  background-color: #fff;
}

/* 栏目标题链接 */
.category-title a {
  color: #2c3e50;
  text-decoration: none;
  transition: color 0.3s ease;
}

.category-title a:hover {
  color: #667eea;
}

/* 文章元数据中的栏目链接 */
.article-meta a {
  color: #667eea;
  text-decoration: none;
  transition: color 0.3s ease;
}

.article-meta a:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* 主内容区 */
main {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

/* 栏目样式 */
.category-section {
  margin-bottom: 40px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  padding: 30px;
  overflow: hidden;
}

.category-title {
  font-size: 1.8rem;
  color: #2c3e50;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid #667eea;
  position: relative;
}

.category-title::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 80px;
  height: 3px;
  background-color: #764ba2;
}

/* 文章列表 */
.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.article-card {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  padding: 25px;
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
}

.article-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  border-color: #667eea;
}

.article-card h3 {
  margin-bottom: 15px;
  font-size: 1.3rem;
  color: #2c3e50;
  line-height: 1.4;
}

.article-card a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s ease;
}

.article-card a:hover {
  color: #667eea;
  text-decoration: none;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85rem;
  color: #6c757d;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9ecef;
}

.meta-item {
  background-color: #f8f9fa;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.article-excerpt {
  color: #6c757d;
  font-size: 0.95rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 文章页面 */
article {
  background-color: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid #e9ecef;
}

article h2 {
  margin-bottom: 20px;
  font-size: 2.2rem;
  color: #2c3e50;
  line-height: 1.3;
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 3px solid #667eea;
  position: relative;
}

article h2::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background-color: #764ba2;
}

.article-content {
  margin-top: 30px;
}

/* 文章元数据 */
article .article-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

article .meta-item {
  background-color: white;
  padding: 5px 15px;
  border-radius: 15px;
  border: 1px solid #dee2e6;
  font-size: 0.9rem;
  color: #6c757d;
  transition: all 0.3s ease;
}

article .meta-item:hover {
  background-color: #667eea;
  color: white;
  border-color: #667eea;
}

/* Markdown 内容样式 */
.article-content h1, .article-content h2, .article-content h3 {
  margin-top: 30px;
  margin-bottom: 15px;
  color: #2c3e50;
}

.article-content h1 {
  font-size: 1.8rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.article-content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

.article-content h3 {
  font-size: 1.2rem;
}

.article-content p {
  margin-bottom: 15px;
  text-align: justify;
  line-height: 1.7;
}

.article-content ul, .article-content ol {
  margin-left: 20px;
  margin-bottom: 15px;
}

.article-content li {
  margin-bottom: 5px;
}

.article-content code {
  background-color: #f1f1f1;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
}

.article-content pre {
  background-color: #f1f1f1;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 15px;
  border-left: 4px solid #3498db;
}

.article-content pre code {
  background-color: transparent;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.article-content blockquote {
  border-left: 4px solid #3498db;
  padding: 10px 20px;
  margin: 15px 0;
  background-color: #f9f9f9;
  border-radius: 0 5px 5px 0;
  font-style: italic;
  color: #666;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.article-content th, .article-content td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.article-content th {
  background-color: #f8f8f8;
  font-weight: 600;
  color: #2c3e50;
}

.article-content tr:hover {
  background-color: #f5f5f5;
}

/* 页脚 */
footer {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  padding: 30px 20px;
  margin-top: 50px;
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 -4px 6px rgba(0,0,0,0.1);
}

footer p {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
}

footer p::before {
  content: '✨ ';
  margin-right: 5px;
}

/* 加载动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-section {
  animation: fadeIn 0.6s ease-out;
}

.article-card {
  animation: fadeIn 0.5s ease-out;
  animation-delay: calc(var(--index) * 0.1s);
  animation-fill-mode: both;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  z-index: 1000;
  width: 0%;
  transition: width 0.1s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .article-list {
    grid-template-columns: 1fr;
  }
  
  article {
    padding: 20px;
  }
  
  header h1 {
    font-size: 1.6rem;
  }
  
  article h2 {
    font-size: 1.5rem;
  }
  
  main {
    padding: 0 15px;
  }
  
  /* 响应式导航条 */
  nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
  }
  
  nav a {
    margin: 0;
    font-size: 1rem;
    padding: 6px 10px;
  }
  
  header {
    padding: 20px 15px;
  }
}

/* 加载动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-card {
  animation: fadeIn 0.5s ease-out;
}

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background-color: #3498db;
  z-index: 1000;
  width: 0%;
  transition: width 0.1s ease;
}