:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --bg: #f8fafc;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #10b981;
  --danger: #ef4444;
  --container-max: 1400px;
  --header-height: 64px;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  line-height: 1.5;
  overflow-x: hidden; /* 防止移动端左右晃动 */
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* Header & Nav */
header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
}

.top-nav { display: flex; gap: 0.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-item {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-item.active { color: var(--primary); background: var(--primary-light); }

/* Main */
main.container { padding-top: 1.5rem; padding-bottom: 3rem; }
.view { display: none; }

.breadcrumb { margin-bottom: 1rem; font-size: 0.815rem; color: var(--text-muted); }
.breadcrumb a { text-decoration: none; color: var(--text-muted); font-weight: 600; }

#table-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; gap: 1rem; }
.page-title-group h2 { margin: 0; font-size: 1.5rem; letter-spacing: -0.02em; color: var(--text-main); }

/* Filters */
.tag-filters { display: flex; flex-wrap: nowrap; gap: 0.5rem; margin-bottom: 1.5rem; overflow-x: auto; padding-bottom: 0.5rem; -webkit-overflow-scrolling: touch; }
.tag-filters::-webkit-scrollbar { display: none; } /* 隐藏过滤器滚动条 */

.filter-tag {
  padding: 0.4rem 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.815rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-tag.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Table Optimization for Mobile */
.table-container {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  overflow-x: auto; /* 允许横向滚动 */
  -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; text-align: left; min-width: 600px; /* 保证移动端不会挤压过细 */ }
th { background: #fafafa; padding: 0.85rem 1rem; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; }

/* 关键列锁定 (可选) - 针对首屏效果，我们先保持全局滚动但优化列宽 */
.fund-name-cell { min-width: 180px; font-weight: 600; }

.score-badge { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-weight: 800; font-size: 0.8rem; }
.score-high { background: #ecfdf5; color: #059669; border: 1px solid #d1fae5; }
.score-mid { background: #fffbeb; color: #d97706; border: 1px solid #fef3c7; }
.score-low { background: #fef2f2; color: #dc2626; border: 1px solid #fee2e2; }

.market-tag { font-size: 0.7rem; padding: 1px 6px; background: var(--border-light); border-radius: 4px; font-weight: 600; color: var(--text-muted); }

/* About & Details */
.about-content { max-width: 800px; margin: 0 auto; background: white; padding: 2.5rem; border-radius: 16px; border: 1px solid var(--border); }

/* Mobile Specific (Max-width: 768px) */
@media (max-width: 768px) {
  .container { padding-left: 1rem; padding-right: 1rem; }
  header { height: auto; padding: 0.75rem 0; }
  header .container { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
  
  .top-nav { width: 100%; padding-bottom: 0.25rem; }
  .nav-item { padding: 0.4rem 0.6rem; font-size: 0.85rem; }

  #table-controls { flex-direction: column; align-items: flex-start; }
  .page-title-group h2 { font-size: 1.35rem; }
  
  /* 移动端隐藏次要列 */
  .hide-mobile { display: none !important; }
  
  /* 详情页卡片优化 */
  .about-content { padding: 1.5rem; }
  #fund-card > div > div { flex-direction: column; align-items: flex-start !important; gap: 1rem; }
}
