/* ===== 全局重置 & 变量 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --bg-dark: #0b0d1a;
  --bg-card: #12152b;
  --bg-card-hover: #1b1f3a;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #1e293b;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: all 0.25s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  scroll-behavior: smooth;
}

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

/* ===== 导航栏 ===== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(11, 13, 26, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

header.scrolled {
  background: rgba(11, 13, 26, 0.92);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo i {
  color: var(--primary);
  font-size: 1.8rem;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 5px;
}

.hamburger span {
  width: 28px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 4px;
  transition: var(--transition);
}

/* ===== 英雄区 ===== */
#hero {
  padding: 140px 0 80px;
  background: linear-gradient(135deg, #0b0d1a 0%, #14172f 50%, #0d1b2a 100%);
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
  pointer-events: none;
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 60px;
  position: relative;
  z-index: 1;
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-text p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 520px;
}

.hero-search {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 4px 4px 4px 20px;
  max-width: 480px;
  transition: var(--transition);
}

.hero-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.hero-search i {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.hero-search input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 12px;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
}

.hero-search input::placeholder {
  color: var(--text-muted);
}

.hero-tags {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tag {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  cursor: pointer;
  transition: var(--transition);
}

.tag:hover {
  background: rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.hero-visual {
  flex: 0 0 280px;
  display: flex;
  justify-content: center;
}

.floating-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.card-icon {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent);
  backdrop-filter: blur(8px);
  animation: float 6s ease-in-out infinite;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-icon:nth-child(2) { animation-delay: -1.5s; color: var(--secondary); }
.card-icon:nth-child(3) { animation-delay: -3s; color: #f59e0b; }
.card-icon:nth-child(4) { animation-delay: -4.5s; color: #10b981; }

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

/* ===== 分类区域 ===== */
#categories {
  padding: 40px 0 20px;
}

.section-header {
  text-align: center;
  margin-bottom: 32px;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
}

.section-header p {
  color: var(--text-secondary);
  margin-top: 8px;
}

.category-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.cat-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.cat-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
}

.cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ===== 工具网格 ===== */
#tools {
  padding: 20px 0 60px;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.grid-header h2 {
  font-size: 1.6rem;
}

.grid-header span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* 卡片 */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: var(--transition);
}

.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}

.tool-card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.card-icon-bg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  flex-shrink: 0;
}

.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-category {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 20px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.card-link i {
  font-size: 0.8rem;
  transition: transform 0.2s;
}

.card-link:hover {
  color: var(--accent);
}

.card-link:hover i {
  transform: translateX(3px);
}

/* ===== 热门排行 ===== */
#popular {
  padding: 60px 0;
  background: rgba(255, 255, 255, 0.01);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.popular-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.popular-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.2);
}

.popular-rank {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 36px;
}

.popular-item:nth-child(1) .popular-rank { color: #f59e0b; }
.popular-item:nth-child(2) .popular-rank { color: #94a3b8; }
.popular-item:nth-child(3) .popular-rank { color: #b45309; }

.popular-info h4 {
  font-size: 1rem;
  font-weight: 600;
}

.popular-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== 页脚 ===== */
footer {
  padding: 60px 0 0;
  background: #060816;
}

.footer-content {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-color);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-brand i {
  font-size: 2rem;
  color: var(--primary);
}

.footer-brand span {
  font-size: 1.4rem;
  font-weight: 700;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links h4 {
  margin-bottom: 16px;
  font-weight: 600;
}

.footer-links a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 10px;
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary);
}

.newsletter-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 4px;
  margin-top: 12px;
}

.newsletter-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 16px;
  color: var(--text-primary);
  outline: none;
  font-size: 0.9rem;
}

.newsletter-box input::placeholder {
  color: var(--text-muted);
}

.newsletter-box button {
  background: var(--primary);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}

.newsletter-box button:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.footer-bottom {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== 回到顶部 ===== */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transition: var(--transition);
  opacity: 0;
  visibility: hidden;
  z-index: 999;
}

#backToTop.visible {
  opacity: 1;
  visibility: visible;
}

#backToTop:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .hero-content {
    flex-direction: column;
    text-align: center;
  }
  .hero-text p {
    margin: 0 auto 28px;
  }
  .hero-search {
    margin: 0 auto;
  }
  .hero-tags {
    justify-content: center;
  }
  .hero-visual {
    display: none;
  }
  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    background: rgba(11, 13, 26, 0.98);
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
    gap: 24px;
    backdrop-filter: blur(20px);
    transform: translateY(-120%);
    transition: transform 0.4s ease;
    border-bottom: 1px solid var(--border-color);
  }
  .nav-links.open {
    transform: translateY(0);
  }
  .hamburger {
    display: flex;
  }
  #hero {
    padding: 120px 0 60px;
  }
  .hero-text h1 {
    font-size: 2.2rem;
  }
  .category-filters {
    gap: 8px;
  }
  .cat-btn {
    padding: 8px 18px;
    font-size: 0.8rem;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
  .popular-grid {
    grid-template-columns: 1fr;
  }
  .footer-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  .hero-text h1 {
    font-size: 1.8rem;
  }
  .hero-search input {
    font-size: 0.9rem;
  }
}