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

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

/* 导航栏 */
nav {
  background: #2c3e50;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

nav li {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

nav a {
  color: #fff;
  text-decoration: none;
  display: block;
  padding: 0.5rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.3s, color 0.3s;
  border-radius: 4px;
  font-weight: 500;
}

nav a:hover {
  background: rgba(255,255,255,0.15);
  color: #3498db;
}

/* 响应式导航 */
@media (max-width: 768px) {
  nav {
    padding: 0.5rem 0.5rem;
  }

  nav ul {
    flex-wrap: nowrap;
    overflow-x: visible;
    justify-content: space-between;
  }

  nav li {
    flex: 1 1 0;
    min-width: 0;
  }

  nav a {
    font-size: 0.85rem;
    padding: 0.4rem 0.2rem;
  }
}

/* 链接样式 */
a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-top: 0;
  font-weight: 600;
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  text-align: center;
}

.btn:hover {
  background: #2980b9;
  transform: translateY(-2px);
  text-decoration: none;
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 1.5rem;
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* UI 风格变体 */
body.ui-style-0 { --primary-color: #3498db; --accent-color: #2ecc71; }
body.ui-style-1 { --primary-color: #2c3e50; --accent-color: #e74c3c; }
body.ui-style-2 { --primary-color: #9b59b6; --accent-color: #f39c12; }
body.ui-style-3 { --primary-color: #34495e; --accent-color: #1abc9c; }
body.ui-style-4 { --primary-color: #e67e22; --accent-color: #3498db; }
body.ui-style-5 { --primary-color: #16a085; --accent-color: #e74c3c; }
body.ui-style-6 { --primary-color: #2980b9; --accent-color: #f1c40f; }
body.ui-style-7 { --primary-color: #c0392b; --accent-color: #27ae60; }
body.ui-style-8 { --primary-color: #2c3e50; --accent-color: #3498db; }
body.ui-style-9 { --primary-color: #27ae60; --accent-color: #e67e22; }
body.ui-style-10 { --primary-color: #d35400; --accent-color: #8e44ad; }
body.ui-style-11 { --primary-color: #8e44ad; --accent-color: #16a085; }
body.ui-style-12 { --primary-color: #2980b9; --accent-color: #c0392b; }
body.ui-style-13 { --primary-color: #d68910; --accent-color: #2c3e50; }
body.ui-style-14 { --primary-color: #145a32; --accent-color: #d35400; }
body.ui-style-15 { --primary-color: #566573; --accent-color: #e74c3c; }

/* 响应式网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

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

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* 返回顶部按钮 */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: all 0.3s;
  z-index: 999;
}

#backToTop:hover {
  background: #2980b9;
  transform: translateY(-4px);
}

#backToTop.show {
  display: flex;
}

/* 平板适配 */
@media (max-width: 1024px) {
  main {
    padding: 0 1rem !important;
  }
}

/* 移动端适配 */
@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .card {
    padding: 1rem;
  }

  #backToTop {
    width: 40px;
    height: 40px;
    bottom: 20px;
    right: 20px;
  }
}

/* 打印样式 */
@media print {
  nav, footer, #backToTop {
    display: none;
  }

  body {
    background: white;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
