/* =========================================================
   n.qxnlm.com —— 涨势猎手
   中式九紫离火运 · 暗紫金主题
   ========================================================= */

:root {
  /* 九紫离火运主题色 */
  --jz-purple: #7c3aed;      /* 九紫 */
  --lh-red: #e0445b;         /* 离火红 */
  --gold: #d4a574;           /* 香槟金 */
  --gold-light: #e8c9a0;     /* 亮金 */
  --rose: #E8A0B4;           /* 玫瑰粉 */
  --violet: #a78bfa;         /* 浅紫 */

  /* 背景层级 */
  --bg-0: #07040d;           /* 最深背景 */
  --bg-1: #0d0717;           /* 页面背景 */
  --bg-2: #140b22;           /* 面板背景 */
  --bg-3: #1b1030;           /* 卡片背景 */
  --bg-4: #241542;           /* 悬浮/hover */

  /* 边框 */
  --border: rgba(167, 139, 250, 0.14);
  --border-strong: rgba(212, 165, 116, 0.32);
  --border-glow: rgba(124, 58, 237, 0.45);

  /* 文字 */
  --text-1: #f2ecfb;         /* 主文字 */
  --text-2: #cbbfe0;         /* 次文字 */
  --text-3: #8f83a8;         /* 弱文字 */

  /* 涨跌（A股红涨绿跌） */
  --up: #ff4d5e;
  --up-soft: rgba(255, 77, 94, 0.14);
  --down: #17c784;
  --down-soft: rgba(23, 199, 132, 0.12);
  --flat: #9a8fb0;

  /* 尺寸 */
  --radius: 14px;
  --radius-lg: 20px;
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'HarmonyOS Sans SC', 'Segoe UI', sans-serif;

  /* 特效 */
  --glow-gold: 0 0 24px rgba(212, 165, 116, 0.28);
  --glow-purple: 0 0 28px rgba(124, 58, 237, 0.40);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-1);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============ 背景氛围 ============ */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 60% 45% at 15% -5%, rgba(124, 58, 237, 0.22), transparent 60%),
    radial-gradient(ellipse 50% 40% at 88% 5%, rgba(224, 68, 91, 0.16), transparent 55%),
    radial-gradient(ellipse 45% 40% at 50% 105%, rgba(212, 165, 116, 0.10), transparent 60%),
    var(--bg-1);
  pointer-events: none;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.7;
}

/* 光点跟随 */
.cursor-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.10), transparent 65%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

/* ============ 顶部导航 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 32px;
  background: rgba(13, 7, 23, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  white-space: nowrap;
}
.logo .mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--jz-purple), var(--lh-red));
  display: grid; place-items: center;
  font-size: 18px;
  box-shadow: var(--glow-purple);
  color: #fff;
}
.logo .zh { color: var(--gold-light); }
.logo .en { color: var(--text-3); font-size: 11px; font-weight: 400; letter-spacing: 2px; }

.nav { display: flex; gap: 6px; margin-left: auto; }
.nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.25s;
  white-space: nowrap;
  position: relative;
}
.nav a:hover { color: var(--text-1); background: var(--bg-4); }
.nav a.active { color: var(--gold-light); background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(212,165,116,0.10)); }
.nav a.active::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -1px;
  transform: translateX(-50%);
  width: 22px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--jz-purple), var(--gold));
  box-shadow: var(--glow-gold);
}

.clock { font-size: 13px; color: var(--text-3); text-align: right; line-height: 1.3; white-space: nowrap; }
.clock .time { font-size: 15px; color: var(--gold-light); font-variant-numeric: tabular-nums; }

/* ============ 跑马灯 ============ */
.ticker {
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden;
  position: relative;
}
.ticker-track { display: flex; gap: 0; width: max-content; animation: ticker-scroll 60s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 14px;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}
.ticker-item .nm { color: var(--text-2); }
.ticker-item .cd { color: var(--text-3); font-size: 12px; }
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ============ Hero ============ */
.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 24px 8px;
  text-align: center;
  position: relative;
}
.hero .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gold-light);
  letter-spacing: 4px;
  padding: 6px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  background: rgba(212, 165, 116, 0.06);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.15;
  background: linear-gradient(120deg, #fff 10%, var(--gold-light) 40%, var(--jz-purple) 65%, var(--rose) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hero-in 0.8s ease;
}
.hero .sub { color: var(--text-2); font-size: 16px; margin-top: 14px; max-width: 640px; margin-left: auto; margin-right: auto; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 34px;
}
.stat-card {
  background: linear-gradient(160deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.05) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.7s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--glow-purple); }
.stat-card:hover::before { transform: translateX(100%); }
.stat-card .label { font-size: 13px; color: var(--text-3); margin-bottom: 8px; }
.stat-card .value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-card .value.gold { color: var(--gold-light); }
.stat-card .value.up { color: var(--up); }
.stat-card .value.down { color: var(--down); }
.stat-card .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ============ 标签栏 ============ */
.tabbar {
  max-width: 1240px;
  margin: 34px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tabbar button {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 15px;
  padding: 11px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.tabbar button:hover { color: var(--text-1); border-color: var(--border-strong); }
.tabbar button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--jz-purple), #5b21b6);
  border-color: transparent;
  box-shadow: var(--glow-purple);
}
.tabbar button .badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 100px;
  background: var(--lh-red);
  color: #fff;
  vertical-align: 1px;
}

/* ============ 预测周期切换 ============ */
.horizon-switch {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  margin-bottom: 18px;
}
.horizon-switch button {
  padding: 8px 22px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s;
}
.horizon-switch button:hover { color: var(--text-1); }
.horizon-switch button.active {
  background: linear-gradient(135deg, var(--jz-purple), #5b21b6);
  color: #fff;
  box-shadow: var(--glow-purple);
}

/* ============ 主内容 ============ */
main { max-width: 1240px; margin: 0 auto; padding: 24px 24px 60px; }
.panel { display: none; }
.panel.active { display: block; animation: fade-up 0.45s ease; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes hero-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-head h2 .ic { font-size: 22px; }
.panel-head .desc { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.panel-head .actions { display: flex; gap: 10px; align-items: center; }

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(212,165,116,0.12), rgba(124,58,237,0.12));
  color: var(--gold-light);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s;
}
.btn:hover { box-shadow: var(--glow-gold); border-color: var(--gold); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--jz-purple), var(--lh-red));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(224, 68, 91, 0.28);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ 榜单表格 ============ */
.table-wrap { border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; background: var(--bg-2); }
.stock-table { width: 100%; border-collapse: collapse; }
.stock-table thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  white-space: nowrap;
}
.stock-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(167,139,250,0.06);
  font-size: 14px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stock-table tbody tr { cursor: pointer; transition: background 0.2s; }
.stock-table tbody tr:hover { background: var(--bg-4); }
.stock-table tbody tr:last-child td { border-bottom: none; }
.num-right { text-align: right; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rank-1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #1a0b00; box-shadow: 0 0 14px rgba(245,158,11,0.4); }
.rank-2 { background: linear-gradient(135deg, #b8c2cc, #e2e8f0); color: #1a1a2e; box-shadow: 0 0 12px rgba(184,194,204,0.35); }
.rank-3 { background: linear-gradient(135deg, #d97706, #f59e0b); color: #2a1200; box-shadow: 0 0 12px rgba(217,119,6,0.35); }
.rank-n { background: var(--bg-4); color: var(--gold-light); border: 1px solid var(--border); }

.stock-cell { display: flex; align-items: center; gap: 10px; }
.stock-cell .nm { font-weight: 600; color: var(--text-1); }
.stock-cell .cd { font-size: 12px; color: var(--text-3); }

.pct-pill {
  display: inline-block;
  min-width: 64px;
  padding: 3px 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}
.pct-pill.up { background: var(--up-soft); color: var(--up); }
.pct-pill.down { background: var(--down-soft); color: var(--down); }
.pct-pill.flat { background: rgba(154,143,176,0.12); color: var(--flat); }

/* ============ 潜力卡片 ============ */
.predict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.predict-card {
  background: linear-gradient(160deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.predict-card:hover { transform: translateY(-4px); border-color: var(--border-glow); box-shadow: var(--glow-purple); }
.predict-card .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.predict-card .nm { font-size: 17px; font-weight: 700; }
.predict-card .cd { font-size: 12px; color: var(--text-3); }
.predict-card .score-wrap { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; }
.score-bar { flex: 1; height: 8px; border-radius: 100px; background: var(--bg-4); overflow: hidden; }
.score-bar .fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--jz-purple), var(--gold)); transition: width 1s ease; box-shadow: 0 0 12px rgba(124,58,237,0.5); }
.score-num { font-size: 22px; font-weight: 800; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.predict-card .sig { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(124, 58, 237, 0.16);
  color: var(--violet);
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.tag.gold { background: rgba(212, 165, 116, 0.14); color: var(--gold-light); border-color: rgba(212,165,116,0.28); }
.tag.red { background: rgba(224, 68, 91, 0.16); color: #ff8a9a; border-color: rgba(224,68,91,0.3); }
.predict-card .foot { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; color: var(--text-3); }
.predict-card .foot b { color: var(--text-1); }

/* ============ 历史战绩 ============ */
.history-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.chart-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 22px;
}
.chart-box h3 { font-size: 15px; color: var(--text-2); margin-bottom: 14px; }
#hitChart { width: 100%; height: 240px; display: block; }
#backtestChart { width: 100%; height: 240px; display: block; }

/* ============ 模型说明 ============ */
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.about-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.about-card .ic { font-size: 28px; margin-bottom: 10px; }
.about-card h3 { font-size: 16px; margin-bottom: 8px; color: var(--gold-light); }
.about-card p { font-size: 14px; color: var(--text-2); }
.about-card .weight { margin-top: 10px; }
.weight-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.weight-row .bar { flex: 1; margin: 0 12px; height: 6px; background: var(--bg-4); border-radius: 100px; overflow: hidden; align-self: center; }
.weight-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--jz-purple), var(--gold)); }

/* ============ 免责声明 ============ */
.disclaimer {
  margin-top: 28px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(224, 68, 91, 0.25);
  background: rgba(224, 68, 91, 0.06);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
}

/* ============ 页脚 ============ */
footer {
  border-top: 1px solid var(--border);
  padding: 30px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ============ 弹窗（个股详情） ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 10, 0.72);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; animation: fade-in 0.25s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), var(--glow-purple);
}
.modal .close {
  position: absolute;
  top: 14px; right: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.modal .close:hover { color: #fff; border-color: var(--lh-red); background: rgba(224,68,91,0.2); }
.modal-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.modal-head .nm { font-size: 24px; font-weight: 800; }
.modal-head .cd { color: var(--text-3); }
.modal-quote { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0 16px; }
.mq-item .l { font-size: 12px; color: var(--text-3); }
.mq-item .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
#klineChart { width: 100%; height: 320px; display: block; }

/* ============ 骨架屏 ============ */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-3);
  border-radius: var(--radius);
  min-height: 200px;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  box-shadow: var(--glow-purple);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .hero h1 { font-size: 34px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .history-summary { grid-template-columns: repeat(2, 1fr); }
  .stock-table thead th, .stock-table tbody td { padding: 10px 8px; font-size: 13px; }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 27px; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card .value { font-size: 24px; }
  .predict-grid { grid-template-columns: 1fr; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--jz-purple); }
