:root {
  --primary-color: #1a365d;
  --secondary-color: #2d3748;
  --accent-color: #ed8936;
  --background-color: #f7fafc;
  --card-bg: #ffffff;
  --success-color: #38a169;
  --danger-color: #e53e3e;
  --border-color: #e2e8f0;
  --text-muted: #718096;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --font-size-base: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: var(--font-size-base);
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--secondary-color);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 1rem;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

.header {
  background: linear-gradient(135deg, var(--primary-color) 0%, #2c5282 100%);
  color: white;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-color) 0%, #f6ad55 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-md);
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text p {
  font-size: 11px;
  opacity: 0.85;
}

.search-box {
  flex: 1;
  max-width: 400px;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 9px 16px 9px 36px;
  border: none;
  border-radius: 50px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--secondary-color);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.search-box input:focus {
  outline: none;
  background: white;
  box-shadow: var(--shadow-lg), 0 0 0 2px rgba(237, 137, 54, 0.3);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.6;
}

.stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  opacity: 0.9;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-color);
}

.nav-tabs {
  background: white;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 60px;
  z-index: 999;
  box-shadow: var(--shadow-sm);
}

.nav-tabs-container {
  max-width: 100%;
}

.nav-tabs-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: 2px;
}

.nav-tab {
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--background-color);
  color: var(--secondary-color);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-tab:hover {
  background: #edf2f7;
}

.nav-tab.active {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.nav-tab .nav-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-tab .nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-tab .count {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 20px;
  font-size: 10px;
  margin-left: 2px;
}

.nav-tab:not(.active) .count {
  background: var(--border-color);
  color: var(--text-muted);
}

.main-content {
  padding: 16px 0;
}

.category-section {
  margin-bottom: 20px;
  scroll-margin-top: 120px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.category-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  box-shadow: var(--shadow-sm);
}

.category-icon svg {
  width: 18px;
  height: 18px;
}

.category-info h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 2px;
}

.category-info p {
  font-size: 11px;
  color: var(--text-muted);
}

.category-count {
  margin-left: auto;
  background: var(--background-color);
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.link-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-color);
}

.link-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-favicon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--background-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.link-favicon svg {
  width: 16px;
  height: 16px;
}

.link-info {
  flex: 1;
  min-width: 0;
}

.link-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-region {
  font-size: 10px;
  color: var(--text-muted);
}

.link-card.recommended .link-name::after {
  content: "★";
  margin-left: 4px;
  font-size: 11px;
  color: #ed8936;
}

.link-description {
  font-size: 11px;
  color: var(--secondary-color);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
}

.tag {
  padding: 2px 6px;
  background: var(--background-color);
  border-radius: 50px;
  font-size: 9px;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.tag:hover {
  background: var(--primary-color);
  color: white;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 0;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 13px;
  color: var(--secondary-color);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.tag-item:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, #2c5282 100%);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.tag-item .tag-count {
  background: var(--background-color);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.tag-item:hover .tag-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.tags-cloud .tag-item.tag-large {
  font-size: 14px;
  padding: 10px 20px;
}

.tags-cloud .tag-item.tag-medium {
  font-size: 13px;
  padding: 8px 16px;
}

.tags-cloud .tag-item.tag-small {
  font-size: 12px;
  padding: 6px 12px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary-color);
  font-size: 13px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.back-link:hover {
  background: var(--background-color);
  color: var(--accent-color);
}

.icon-tags {
  background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
}

.icon-news {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.icon-stocks-cn {
  background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.icon-stocks-hk {
  background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
}

.icon-stocks-us {
  background: linear-gradient(135deg, #3182ce 0%, #2b6cb0 100%);
}

.icon-funds, .icon-fund {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.icon-etf {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.icon-bonds, .icon-bond {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.icon-fixed-income {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.icon-futures {
  background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
}

.icon-index-futures {
  background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
}

.icon-energy {
  background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
}

.icon-precious-metals {
  background: linear-gradient(135deg, #f6e05e 0%, #d69e2e 100%);
}

.icon-base-metals {
  background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
}

.icon-agriculture {
  background: linear-gradient(135deg, #68d391 0%, #48bb78 100%);
}

.icon-forex {
  background: linear-gradient(135deg, #4fd1c5 0%, #38b2ac 100%);
}

.icon-realestate {
  background: linear-gradient(135deg, #f687b3 0%, #ed64a6 100%);
}

.icon-insurance {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.icon-banking {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.icon-crypto {
  background: linear-gradient(135deg, #f6e05e 0%, #d69e2e 100%);
}

.icon-defi {
  background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
}

.icon-nft {
  background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
}

.icon-tools {
  background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
}

.footer {
  background: var(--primary-color);
  color: white;
  padding: 16px 0;
  margin-top: 30px;
}

.footer-bottom {
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-results h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--secondary-color);
}

.no-results p {
  font-size: 14px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-section {
  animation: fadeIn 0.3s ease;
}

@media (max-width: 1200px) {
  .links-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .search-box {
    max-width: 100%;
    width: 100%;
  }

  .stats {
    justify-content: center;
  }

  .nav-tabs {
    top: auto;
    position: relative;
  }

  .category-section {
    scroll-margin-top: 20px;
  }

  .links-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-content {
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 12px 0;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .logo-text h1 {
    font-size: 16px;
  }

  .stats {
    gap: 12px;
  }

  .stat-value {
    font-size: 16px;
  }

  .nav-tab {
    padding: 4px 10px;
    font-size: 11px;
  }

  .main-content {
    padding: 12px 0;
  }

  .category-section {
    margin-bottom: 16px;
  }

  .category-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .category-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .category-icon svg {
    width: 16px;
    height: 16px;
  }

  .category-info h2 {
    font-size: 13px;
  }

  .category-count {
    display: none;
  }

  .links-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .link-card {
    padding: 8px;
  }

  .link-favicon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .link-favicon svg {
    width: 14px;
    height: 14px;
  }

  .link-name {
    font-size: 11px;
  }

  .link-description {
    font-size: 10px;
    -webkit-line-clamp: 1;
  }

  .back-to-top {
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 8px;
  }

  .links-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .link-card {
    padding: 6px;
    gap: 4px;
  }

  .link-card .link-tags {
    display: none;
  }

  .nav-tabs-wrapper {
    gap: 3px;
  }

  .nav-tab {
    padding: 4px 8px;
    font-size: 10px;
  }

  .nav-tab .count {
    display: none;
  }

  .nav-tab .nav-icon {
    width: 12px;
    height: 12px;
  }

  .tag-item {
    padding: 5px 10px;
    font-size: 11px;
  }

  .tag-item .tag-count {
    font-size: 10px;
    padding: 1px 4px;
  }
}
