/* 全局样式 */
:root {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --accent-color: #e74c3c;
  --success-color: #16a085;
  --bg-color: #f5f5f5;
  --card-bg: #ffffff;
  --text-color: #333333;
  --text-muted: #7f8c8d;
  --border-color: #e0e0e0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  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";
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  font-size: 16px;
}

/* 头部样式 */
.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--secondary-color);
  text-decoration: none;
  display: inline-block;
  transition: color 0.3s ease;
}

.logo:hover {
  color: var(--primary-color);
}

/* 导航样式 */
nav {
  margin-top: 0.5rem;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  overflow-x: hidden;
}

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

nav a {
  text-decoration: none;
  color: #555;
  padding: 0.5rem 1rem;
  display: block;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
}

nav a:hover {
  color: var(--primary-color);
  background: rgba(52, 152, 219, 0.1);
}

/* 主内容区 */
main {
  padding: 2rem 1rem;
  min-height: calc(100vh - 200px);
}

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

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

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
  font-weight: 600;
}

h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.2rem;
}

/* 链接样式 */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-color);
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.btn:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 标签样式 */
.tag {
  display: inline-block;
  background: #ecf0f1;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin: 0.2rem;
  font-size: 0.9rem;
  color: var(--secondary-color);
}

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

/* 响应式设计 */
@media (max-width: 768px) {
  nav ul {
    flex-wrap: nowrap;
    overflow-x: hidden;
  }

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

  nav a {
    padding: 0.4rem 0.3rem;
    font-size: 0.85rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .logo {
    font-size: 1.2rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  main {
    padding: 1rem 0.5rem;
  }
}

@media (max-width: 480px) {
  nav a {
    font-size: 0.75rem;
    padding: 0.3rem 0.2rem;
  }

  .logo {
    font-size: 1rem;
  }
}

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

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary-color);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 99;
}

.back-to-top:hover {
  background: var(--accent-color);
  transform: translateY(-4px);
}

.back-to-top.show {
  display: flex;
}

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

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

/* 打印样式 */
@media print {
  .header, nav, .back-to-top {
    display: none;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
