:root {
  --bg-primary: #05070a;
  --bg-secondary: #0b0f18;
  --bg-card: rgba(13, 18, 30, 0.78);
  --bg-hover: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(0, 245, 212, 0.35);
  --text-primary: #f4f6ff;
  --text-secondary: #8b94b4;
  --text-muted: #4f5a75;
  --accent-cyan: #00f5d4;
  --accent-gold: #ffd166;
  --accent-purple: #9b5de5;
  --accent-rose: #f15bb5;
  --accent-green: #00f5a0;
  --accent-red: #ff6b6b;
  --accent-blue: #3a86ff;
  --shadow-cyan: 0 0 30px rgba(0, 245, 212, 0.12);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-width: 260px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* 背景 */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(0, 245, 212, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(155, 93, 229, 0.05) 0%, transparent 40%),
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 64px 64px, 64px 64px;
  z-index: -2;
  pointer-events: none;
}

.bg-noise {
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  z-index: -1;
  pointer-events: none;
}

/* 布局 */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(8, 11, 19, 0.92);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
  padding: 0 12px 32px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: var(--shadow-cyan);
}

.nav-section {
  margin-bottom: 28px;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 12px 12px;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.25s;
}

.nav-links a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-links a.active {
  background: rgba(0, 245, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid var(--border-accent);
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 1.05rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
}

.wallet-btn {
  width: 100%;
  padding: 12px;
  border-radius: 100px;
  border: 1px solid var(--border-accent);
  background: rgba(0, 245, 212, 0.08);
  color: var(--accent-cyan);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  font-size: 0.9rem;
}

.wallet-btn:hover {
  background: rgba(0, 245, 212, 0.14);
  box-shadow: var(--shadow-cyan);
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 36px 48px;
  max-width: calc(100% - var(--sidebar-width));
  min-width: 0;
  overflow-x: hidden;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.8px;
  margin-bottom: 6px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.card-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 2px;
}

/* 统计卡片 */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.3s;
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: 14px;
}

.stat-icon.cyan { background: rgba(0, 245, 212, 0.12); }
.stat-icon.gold { background: rgba(255, 209, 102, 0.12); }
.stat-icon.purple { background: rgba(155, 93, 229, 0.15); }
.stat-icon.rose { background: rgba(241, 91, 181, 0.12); }

.stat-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-change {
  font-size: 0.75rem;
  color: var(--accent-green);
}

.stat-change.negative {
  color: var(--accent-red);
}

/* 网格布局 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.grid-2 > *,
.grid-3 > *,
.grid-4 > *,
.stats-row > * {
  min-width: 0;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  font-size: 0.9rem;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table .amount {
  font-weight: 700;
  color: var(--accent-cyan);
}

.data-table .positive {
  color: var(--accent-green);
  font-weight: 600;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

.tag.featured {
  background: rgba(255, 209, 102, 0.15);
  color: var(--accent-gold);
}

/* 按钮 */
.btn {
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #00c9a7);
  color: #071018;
}

.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 28px rgba(0, 245, 212, 0.28);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-block {
  width: 100%;
}

/* 输入框 */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--accent-cyan);
}

/* 进度条 */
.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  transition: width 0.6s ease;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-cyan { background: rgba(0, 245, 212, 0.12); color: var(--accent-cyan); }
.badge-gold { background: rgba(255, 209, 102, 0.12); color: var(--accent-gold); }
.badge-purple { background: rgba(155, 93, 229, 0.15); color: var(--accent-purple); }
.badge-rose { background: rgba(241, 91, 181, 0.12); color: var(--accent-rose); }

/* 移动端导航 */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(5, 7, 10, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  align-items: center;
  justify-content: space-between;
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(8, 11, 19, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 10px 0 calc(14px + env(safe-area-inset-bottom));
  justify-content: space-around;
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.65rem;
}

.mobile-nav a.active {
  color: var(--accent-cyan);
}

.mobile-nav .nav-icon {
  font-size: 1.2rem;
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  place-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: grid;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal h3 {
  margin-bottom: 20px;
  font-size: 1.3rem;
}

/* 表格滚动容器 */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -28px;
  padding: 0 28px;
}
.table-scroll .data-table {
  min-width: 600px;
}

/* 移动端汉堡菜单 */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  left: 12px;
  right: 12px;
  background: rgba(8, 11, 19, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  z-index: 98;
  backdrop-filter: blur(20px);
}
.mobile-menu.active {
  display: block;
}
.mobile-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}
.mobile-menu a.active {
  background: rgba(0, 245, 212, 0.1);
  color: var(--accent-cyan);
}

/* 响应式 */
@media (max-width: 1200px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-header { display: flex; }
  .mobile-nav { display: flex; }
  .mobile-menu-btn { display: flex; }
  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 80px 20px 90px;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .modal {
    padding: 24px 20px;
    max-width: 100%;
    margin: 0 16px;
  }
  .modal-overlay {
    padding: 0;
    align-items: end;
  }
  .modal-overlay.active {
    align-items: center;
  }
}

@media (max-width: 560px) {
  .stats-row, .grid-4 { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.5rem; }
  .page-header p { font-size: 0.85rem; }
  .card { padding: 20px; }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .btn {
    padding: 14px 20px;
    min-height: 48px;
  }
  .wallet-btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
  .table-scroll {
    margin: 0 -20px;
    padding: 0 20px;
  }
  .data-table th,
  .data-table td {
    padding: 12px 10px;
    font-size: 0.85rem;
  }
  .mobile-nav a {
    font-size: 0.6rem;
  }
  .mobile-nav .nav-icon {
    font-size: 1.1rem;
  }
}

/* H5 移动端深度适配 */
@media (max-width: 480px) {
  .landing-hero { padding: 120px 20px 60px; }
  .landing-hero h1 { font-size: 2.2rem; letter-spacing: -1px; }
  .landing-hero p { font-size: 0.95rem; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stat { padding: 18px; }
  .hero-stat .value { font-size: 1.5rem; }
  .section { padding: 60px 20px; }
  .section-title { font-size: 1.6rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { padding: 22px; }
  .how-it-works { grid-template-columns: 1fr; gap: 28px; }
  .step-number { width: 44px; height: 44px; font-size: 1.2rem; }
  .cta-section { padding: 40px 24px; }
  .cta-section h2 { font-size: 1.5rem; }

  .position-metrics { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .position-metric { padding: 14px; }
  .position-metric .value { font-size: 1.05rem; }
  .position-metric .label { font-size: 0.7rem; }
  .position-header { flex-direction: column; align-items: flex-start; }
  .position-invested { text-align: left; width: 100%; }

  .tier-summary { grid-template-columns: repeat(2, 1fr); }
  .member-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .member-amount { width: 100%; display: flex; justify-content: space-between; }
  .member-amount .value { font-size: 1rem; }
  .member-amount .label { font-size: 0.75rem; }

  .level-filter { gap: 8px; }
  .filter-chip { padding: 8px 14px; font-size: 0.8rem; }

  .table-scroll {
    margin: 0 -20px;
    padding: 0 20px;
    scrollbar-width: thin;
  }
  .table-scroll::-webkit-scrollbar { height: 4px; }
  .table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 2px;
  }

  .mobile-nav a { font-size: 0.55rem; }
  .mobile-nav { padding: 8px 0 calc(12px + env(safe-area-inset-bottom)); }

  /* 团队等级权益表转卡片 */
  .level-table-mobile {
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  .level-table-mobile .level-table {
    width: 100% !important;
    min-width: auto !important;
  }
  .level-table-mobile .level-table thead,
  .level-table-mobile .level-table tbody,
  .level-table-mobile .level-table th,
  .level-table-mobile .level-table td,
  .level-table-mobile .level-table tr {
    display: block;
    width: 100%;
  }
  .level-table-mobile .level-table thead {
    display: none;
  }
  .level-table-mobile .level-table tr {
    margin-bottom: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  }
  .level-table-mobile .level-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
  }
  .level-table-mobile .level-table td:last-child {
    border-bottom: none;
  }
  .level-table-mobile .level-table td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 0.78rem;
  }
}
