/* ═══ AIPAD 全局样式 ═══ */
:root {
  --bg: #0a0e1a;
  --bg-card: #111827;
  --bg-alt: #0f1525;
  --border: #1e2a3f;
  --border-hover: #2d3f5f;
  --text: #e8ecf4;
  --text-dim: #8896b0;
  --text-muted: #5a6885;
  --accent: #f0a500;
  --accent-glow: rgba(240,165,0,0.15);
  --accent2: #00d4aa;
  --accent2-glow: rgba(0,212,170,0.12);
  --red: #ff5757;
  --green: #00d4aa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.85em; }

/* ═══ 导航栏 ═══ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,14,26,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: 1px; }
.logo-sub { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.nav-links { display: flex; gap: 24px; }
.nav-link {
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }
.nav-status { display: flex; align-items: center; gap: 6px; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.connecting { background: #f0a500; animation: pulse 1s infinite; }
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.status-text { font-size: 12px; color: var(--text-muted); }

/* ═══ Hero ═══ */
.hero {
  position: relative; padding: 80px 24px 60px; text-align: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, var(--accent-glow), transparent 70%),
              radial-gradient(ellipse 40% 30% at 80% 20%, var(--accent2-glow), transparent 60%);
  z-index: -1;
}
.hero-title {
  font-size: clamp(48px, 8vw, 96px); font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #ffd966, var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
}
.hero-subtitle {
  font-size: clamp(16px, 2vw, 22px); color: var(--text-dim);
  margin-top: 8px; max-width: 600px; margin-inline: auto;
}
.hero-stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 32px; margin-top: 48px;
}
.hero-stat { display: flex; flex-direction: column; align-items: center; }
.stat-num {
  font-size: 32px; font-weight: 700; color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ═══ Section ═══ */
.section { max-width: 1280px; margin: 0 auto; padding: 60px 24px; }
.section-alt { background: var(--bg-alt); max-width: none; }
.section-alt > * { max-width: 1280px; margin-inline: auto; }
.section-header { margin-bottom: 32px; }
.section-title { font-size: 28px; font-weight: 700; }
.section-desc { color: var(--text-dim); font-size: 15px; margin-top: 4px; }
.section-controls { display: flex; gap: 12px; margin-top: 16px; }
.search-input, .filter-select {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 10px 16px; font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.search-input:focus, .filter-select:focus { border-color: var(--accent); }
.search-input { flex: 1; max-width: 320px; }

/* ═══ 代币卡片网格 ═══ */
.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.loading-card {
  grid-column: 1/-1; text-align: center; padding: 60px; color: var(--text-muted);
}
.loader {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.token-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color 0.3s, transform 0.3s;
  position: relative; overflow: hidden;
}
.token-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.token-card.graduated { border-color: rgba(0,212,170,0.2); }

.token-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.token-card.graduated::before {
  background: linear-gradient(90deg, var(--accent2), transparent);
}

.token-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.token-name { font-size: 18px; font-weight: 700; }
.token-symbol {
  display: inline-block; background: rgba(240,165,0,0.1); color: var(--accent);
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
  margin-left: 8px;
}
.token-badge {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
}
.badge-bonding { background: rgba(240,165,0,0.15); color: var(--accent); }
.badge-graduated { background: rgba(0,212,170,0.15); color: var(--accent2); }

.token-price {
  font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 700;
  margin: 12px 0 4px;
}
.token-price-label { font-size: 12px; color: var(--text-muted); }

.token-progress { margin: 16px 0; }
.progress-bar {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #ffd966);
  border-radius: 3px; transition: width 0.6s ease;
}
.token-card.graduated .progress-fill {
  background: linear-gradient(90deg, var(--accent2), #4fffd4);
}
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); margin-top: 6px;
}

.token-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px;
}
.stat-item { font-size: 13px; }
.stat-item-label { color: var(--text-muted); }
.stat-item-value { color: var(--text); font-family: 'JetBrains Mono', monospace; font-weight: 500; }

.token-addr {
  margin-top: 14px; font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.token-addr a { color: var(--accent); text-decoration: none; }
.token-addr a:hover { text-decoration: underline; }

/* ═══ AI 指南 ═══ */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}
.guide-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.guide-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.guide-icon { font-size: 24px; }
.guide-card h3 { font-size: 16px; font-weight: 600; }
.guide-code {
  background: #0a0d15; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; overflow-x: auto; margin-bottom: 12px;
}
.guide-code code {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.8;
  white-space: pre; color: #c8d6e5;
}
.cmt { color: #5a6885; }
.var { color: #f0a500; }
.fn  { color: #00d4aa; }
.guide-note { font-size: 13px; color: var(--text-dim); }
.guide-list { list-style: none; padding: 0; }
.guide-list li {
  padding: 8px 0; font-size: 13px; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.guide-list li:last-child { border-bottom: none; }
.guide-list .addr { color: var(--accent); margin-left: 4px; }

.api-method {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; margin-right: 8px;
}
.api-method.get { background: rgba(0,212,170,0.15); color: var(--accent2); }
.api-method.ws  { background: rgba(240,165,0,0.15); color: var(--accent); }

/* ═══ 规则卡片 ═══ */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.rule-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  transition: border-color 0.3s;
}
.rule-card:hover { border-color: var(--border-hover); }
.rule-icon { font-size: 36px; display: block; margin-bottom: 12px; }
.rule-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.rule-card p { font-size: 14px; color: var(--text-dim); line-height: 1.7; }

/* ═══ Footer ═══ */
.footer {
  border-top: 1px solid var(--border); padding: 32px 24px;
  text-align: center; color: var(--text-muted); font-size: 13px;
}
.footer-links { margin-top: 8px; }
.footer-links a { color: var(--accent); text-decoration: none; }

/* ═══ 响应式 ═══ */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-stats { gap: 20px; }
  .stat-num { font-size: 24px; }
  .token-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: 1fr; }
}

/* ═══ Toast ═══ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 24px;
  color: var(--text); font-size: 14px; z-index: 200;
  opacity: 0; transition: all 0.3s ease;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══ 复制按钮 ═══ */
.copy-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 2px 4px;
  transition: color 0.2s;
}
.copy-btn:hover { color: var(--accent); }

/* ═══ Tab 切换 ═══ */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ═══ 排行榜 ═══ */
.ranking-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.ranking-tab {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 20px;
  color: var(--text-dim); font-size: 14px; cursor: pointer;
  transition: all 0.2s;
}
.ranking-tab.active {
  background: rgba(240,165,0,0.15); border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}
.ranking-list { display: flex; flex-direction: column; gap: 8px; }
.ranking-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px; cursor: pointer;
  transition: border-color 0.2s;
}
.ranking-item:hover { border-color: var(--border-hover); }
.ranking-num { font-size: 18px; min-width: 36px; font-weight: 700; }
.ranking-name { flex: 1; font-weight: 600; font-size: 15px; }
.ranking-price { font-family: 'JetBrains Mono', monospace; font-size: 13px; min-width: 120px; }
.ranking-progress { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.ranking-raised { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--accent); min-width: 80px; }
.ranking-badge { font-size: 12px; color: var(--text-muted); min-width: 80px; }

/* ═══ 持仓查询 ═══ */
.portfolio-input-row {
  display: flex; gap: 12px; margin-bottom: 24px; max-width: 640px;
}
.portfolio-result { margin-top: 8px; }
.portfolio-summary {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 20px;
  display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 8px;
  font-size: 14px;
}
.btn-primary {
  background: var(--accent); color: #000; border: none;
  border-radius: var(--radius-sm); padding: 10px 20px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s; white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }
.btn-secondary {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 16px;
  color: var(--text-dim); font-size: 13px; cursor: pointer;
  transition: border-color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ═══ 代币详情弹窗 ═══ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 860px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-card); z-index: 10;
}
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }

/* ═══ 代币详情 ═══ */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.detail-item {
  background: var(--bg-alt); border-radius: var(--radius-sm); padding: 12px 16px;
}
.detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-value { font-size: 15px; font-weight: 600; margin-top: 4px; }
.detail-value a { color: var(--accent); text-decoration: none; }

.subsection-title {
  font-size: 15px; font-weight: 600; color: var(--text-dim);
  margin: 20px 0 12px; text-transform: uppercase; letter-spacing: 0.5px;
}

/* ═══ 交易记录表 ═══ */
.trades-table { font-size: 13px; }
.trades-row {
  display: grid; grid-template-columns: 80px 120px 80px 80px 90px;
  gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border);
  align-items: center;
}
.trades-header {
  color: var(--text-muted); font-size: 11px; text-transform: uppercase;
  font-weight: 600; letter-spacing: 0.5px;
}
.trade-type.buy  { color: var(--green); }
.trade-type.sell { color: var(--red); }
.danger { color: var(--red); }

/* ═══ 响应式补充 ═══ */
@media (max-width: 768px) {
  .ranking-item { flex-wrap: wrap; gap: 8px; }
  .ranking-progress { display: none; }
  .portfolio-input-row { flex-direction: column; }
  .trades-row { grid-template-columns: 60px 1fr 60px; }
  .trades-row span:nth-child(4), .trades-row span:nth-child(5) { display: none; }
}
