:root {
  --primary-color: #4f46e5;
  --primary-light: #e0e7ff;
  --primary-dark: #4338ca;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --bg-color: #f9fafb;
  --card-bg: #ffffff;
  --secondary-bg: #f3f4f6;
  --border-color: #e5e7eb;
  --hover-bg: #f9fafb;
  --success-color: #16a34a;
  --error-color: #dc2626;
  --warning-color: #f59e0b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #818cf8;
    --primary-light: #312e81;
    --primary-dark: #6366f1;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --bg-color: #111827;
    --card-bg: #1f2937;
    --secondary-bg: #374151;
    --border-color: #374151;
    --hover-bg: #374151;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  font-size: 1.5rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--primary-color);
}

.main {
  min-height: calc(100vh - 64px - 80px);
  padding: 1.5rem 0;
}

.site-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 0;
  margin-top: 2rem;
}

.site-footer p {
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

a {
  color: var(--primary-color);
}

a:hover {
  color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
}

.trend-card {
  display: block;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.trend-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.trend-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.category-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary-color);
}

.category-ai {
  background: #e0e7ff;
  color: #4f46e5;
}

@media (prefers-color-scheme: dark) {
  .category-ai {
    background: #312e81;
    color: #a5b4fc;
  }
}

.change {
  font-size: 0.875rem;
  font-weight: 600;
}

.change.up {
  color: #16a34a;
}

.change.down {
  color: #dc2626;
}

.trend-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--text-primary);
}

.trend-card-value {
  display: flex;
  flex-direction: column;
}

.trend-card-value .value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1;
}

.trend-card-value .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.top-keywords {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.top-keywords .section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 1.25rem 0;
  color: var(--text-primary);
}

.keywords-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.keyword-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.keyword-item:hover {
  background: var(--hover-bg);
}

.rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
  background: var(--secondary-bg);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.rank-top {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
}

.keyword-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.keyword-name {
  font-weight: 600;
  color: var(--text-primary);
}

.keyword-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 140px;
}

.keyword-stats .stat-value {
  font-weight: 700;
  color: var(--primary-color);
  min-width: 36px;
  text-align: right;
}

.progress-bar {
  width: 80px;
  height: 6px;
  background: var(--secondary-bg);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  border-radius: 3px;
  transition: width 0.3s ease;
}

@media (max-width: 768px) {
  .nav-links {
    gap: 1rem;
  }

  .nav-links a {
    font-size: 0.875rem;
  }

  .keyword-stats {
    display: none;
  }
}
