/* ========== 变量 ========== */
:root {
  --bg: #09090b;
  --fg: #fafafa;
  --muted: #71717a;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --card: rgba(24, 24, 27, 0.8);
  --border: rgba(63, 63, 70, 0.5);
  --glow: rgba(34, 211, 238, 0.15);
  
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Noto Sans SC', sans-serif;
  
  --radius: 4px;
  --radius-lg: 8px;
}

/* ========== 重置 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== 网格背景 ========== */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: -2;
}

/* ========== 粒子 ========== */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.3;
  animation: drift 20s linear infinite;
}

.particle:nth-child(1) { top: 10%; left: 20%; animation-duration: 25s; }
.particle:nth-child(2) { top: 30%; left: 80%; animation-duration: 30s; animation-delay: -5s; }
.particle:nth-child(3) { top: 60%; left: 10%; animation-duration: 35s; animation-delay: -10s; }
.particle:nth-child(4) { top: 80%; left: 60%; animation-duration: 28s; animation-delay: -15s; }
.particle:nth-child(5) { top: 50%; left: 50%; animation-duration: 22s; animation-delay: -8s; }

@keyframes drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(100px, -100px); }
}

/* ========== App容器 ========== */
.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ========== 顶部 ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.brand-text {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-divider {
  opacity: 0.3;
}

/* ========== 标题区 ========== */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.title-accent {
  color: var(--accent);
}

.subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.update-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.6;
}

/* ========== 数据源 ========== */
.sources {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.source-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.source-btn:hover {
  border-color: var(--accent);
  color: var(--fg);
}

.source-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.src-icon {
  font-size: 0.75rem;
}

/* ========== 分类 ========== */
.categories {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 2rem;
}

.cat-btn {
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.cat-btn:hover {
  color: var(--fg);
  background: rgba(255,255,255,0.05);
}

.cat-btn.active {
  color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
}

/* ========== 词云 ========== */
.wordcloud-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 3rem;
  min-height: 350px;
}

.wordcloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

/* ========== 词汇样式 ========== */
.word {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.2s;
  white-space: nowrap;
}

.word:hover {
  transform: scale(1.08);
  background: rgba(255,255,255,0.1);
}

/* 热度 */
.word-heat-5 { font-size: 1.5rem; font-weight: 700; }
.word-heat-4 { font-size: 1.25rem; font-weight: 600; }
.word-heat-3 { font-size: 1rem; }
.word-heat-2 { font-size: 0.875rem; opacity: 0.8; }
.word-heat-1 { font-size: 0.75rem; opacity: 0.6; }

/* 分类色 */
.word-model { color: #22d3ee; }
.word-tool { color: #a78bfa; }
.word-concept { color: #34d399; }
.word-company { color: #fbbf24; }

/* ========== 热门 ========== */
.trending {
  margin-bottom: 3rem;
}

.trending-title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1rem;
}

.trending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.trending-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.trending-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.trending-rank {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  line-height: 1.5rem;
  text-align: center;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.trending-card .title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.trending-card .meta {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ========== 底部 ========== */
.footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.footer p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.6;
}

/* ========== 弹窗 ========== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.9);
}

.modal-box {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
}

.modal-x {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.modal-x:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.modal-head {
  margin-bottom: 1rem;
}

.modal-head h3 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.modal-tags {
  display: flex;
  gap: 0.5rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
}

.tag-cat {
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent);
}

.tag-heat {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.modal-rel {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.rel-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.5rem;
}

.rel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.rel-tags .tag {
  background: rgba(167, 139, 250, 0.15);
  color: var(--accent-2);
}

/* ========== 动画 ========== */
.word {
  opacity: 0;
  animation: wordIn 0.4s ease forwards;
}

@keyframes wordIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .app {
    padding: 1.5rem 1rem;
  }
  
  .header {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .title {
    font-size: 2rem;
  }
  
  .wordcloud-wrap {
    padding: 1.25rem;
  }
  
  .word-heat-5 { font-size: 1.25rem; }
  .word-heat-4 { font-size: 1.1rem; }
}

/* ========== 减少动画 ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}