*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface2: #1f2937;
  --surface3: #283548;
  --border: #374151;
  --border-l: #4b5563;
  --primary: #3b82f6;
  --primary-l: #1e3a5f;
  --primary-d: #2563eb;
  --accent: #8b5cf6;
  --accent-l: #2e1065;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --up: #22c55e;
  --up-l: rgba(34,197,94,0.12);
  --down: #ef4444;
  --down-l: rgba(239,68,68,0.12);
  --gold: #eab308;
  --gold-l: #422006;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-h: 0 4px 24px rgba(59,130,246,0.15);
  --glow: 0 0 20px rgba(59,130,246,0.1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --border: #e2e8f0;
  --border-l: #cbd5e1;
  --text: #1e293b;
  --text2: #64748b;
  --text3: #94a3b8;
  --shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-h: 0 4px 18px rgba(59,130,246,0.12);
  --glow: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ── */
.topnav {
  background: rgba(17,24,39,0.85);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
[data-theme="light"] .topnav { background: rgba(255,255,255,0.85); }

.topnav-inner {
  max-width: 1360px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 0 24px; gap: 0;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; margin-right: 28px; text-decoration: none; flex-shrink: 0;
}
.brand-icon { font-size: 24px; }
.brand-name { font-size: 18px; font-weight: 800; background: linear-gradient(135deg, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.brand-sub { font-size: 10px; color: var(--text3); }

.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link {
  padding: 8px 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text2); text-decoration: none;
  transition: var(--transition);
}
.nav-link:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-l); color: var(--primary); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 16px; transition: var(--transition);
}
.theme-toggle:hover { background: var(--surface2); }

.update-chip {
  font-size: 11px; color: var(--text3);
  padding: 4px 10px; background: var(--surface2);
  border-radius: 20px;
}

.ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  background: linear-gradient(135deg, #1e3a5f, #2e1065);
  color: #a5b4fc; font-size: 11px; font-weight: 600;
}
[data-theme="light"] .ai-badge { background: linear-gradient(135deg, #dbeafe, #ede9fe); color: #4338ca; }

/* ── Hero Stats Bar ── */

/* Mobile Nav */
.mobile-nav-toggle { display: none; }
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px; z-index: 99; }
  .nav-links.open { display: flex; }
  .nav-link { padding: 12px 16px; }
  .mobile-nav-toggle { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; color: var(--text); font-size: 18px; margin-left: auto; }
  .nav-right { gap: 6px; }
  .update-chip { display: none; }
  .ai-badge { font-size: 9px; padding: 2px 6px; }
  .hero-bar { grid-template-columns: repeat(2, 1fr); }
  .tab-btn { padding: 8px 14px; font-size: 12px; }
  .stock-list { grid-template-columns: 1fr; }
  .page-wrap { grid-template-columns: 1fr; padding: 16px; }
  .hero-stat-value { font-size: 18px; }
  .search-bar { flex-direction: column; align-items: stretch; }
  .filter-pills { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .filter-pill { white-space: nowrap; }
}
/* Back to Top */
.back-top {
  position: fixed; bottom: 24px; right: 24px;
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border: none; cursor: pointer;
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: all 0.3s;
  z-index: 200; box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(59,130,246,0.4); }
/* Footer */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 32px 24px; margin-top: 40px;
}
.footer-inner {
  max-width: 1360px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.footer-left { display: flex; align-items: center; gap: 10px; }
.footer-brand { font-size: 16px; font-weight: 800; background: linear-gradient(135deg, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.footer-copy { font-size: 12px; color: var(--text3); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { font-size: 12px; color: var(--text3); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--primary); }
@media (max-width: 768px) {
  .footer-inner { flex-direction: column; text-align: center; }
}