/* ===== 双色球三角函数时序模型 · 样式 ===== */
:root {
  --bg: #0e1420;
  --bg-panel: #161e2e;
  --bg-panel-2: #1b2436;
  --line: #263149;
  --text: #e8ecf4;
  --text-dim: #9aa6bd;
  --red: #e64545;
  --red-soft: #a53131;
  --blue: #3d78e0;
  --amber: #f0a83a;
  --green: #3fbf7f;
  --mono: "SFMono-Regular", "Consolas", "JetBrains Mono", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Noto Sans SC", -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ===== 布局 ===== */
.app { max-width: 1280px; margin: 0 auto; padding: 0 20px 80px; }

header.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14,20,32,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .5px; }
.logo-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--red), var(--red-soft)); color: #fff; font-size: 14px; font-weight: 800; }
.subtitle { color: var(--text-dim); font-size: 12px; }

.notice {
  margin: 16px 0; padding: 12px 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--amber);
  background: var(--bg-panel); border-radius: 6px;
  font-size: 13px; color: var(--text-dim);
}
.notice b { color: var(--amber); }

/* ===== 控制面板 ===== */
.panel {
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; margin: 14px 0;
}
.panel h3 { font-size: 14px; margin-bottom: 12px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.panel h3::before { content: ""; width: 4px; height: 14px; background: var(--red); border-radius: 2px; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.field .val { font-family: var(--mono); color: var(--amber); font-size: 13px; }
input[type=range] { width: 100%; accent-color: var(--red); }
.field-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--bg-panel-2);
  color: var(--text); border-radius: 6px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #22304a; border-color: var(--text-dim); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #d43b3b; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.file-input { position: relative; overflow: hidden; }
.file-input input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ===== 指标图表区 ===== */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; }
.chart-card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.chart-card h4 { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.chart-card .fit-info { font-size: 12px; color: var(--text-dim); font-family: var(--mono); margin-bottom: 8px; }
.chart-box { width: 100%; height: 260px; }

/* ===== 结果 ===== */
.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.metric { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.metric .label { font-size: 12px; color: var(--text-dim); }
.metric .big { font-family: var(--mono); font-size: 26px; font-weight: 700; margin-top: 4px; }
.metric .big.red { color: var(--red); }
.metric .big.green { color: var(--green); }
.metric .big.amber { color: var(--amber); }
.metric .sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.candidate-area { margin-top: 6px; }
.candidate-list {
  display: flex; flex-wrap: wrap; gap: 8px; max-height: 340px; overflow: auto;
  margin-top: 12px; padding: 4px 2px;
}
.combo {
  display: flex; gap: 4px; align-items: center; padding: 6px 8px;
  background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
  transition: border-color .15s;
}
.combo:hover { border-color: var(--red); }
.ball { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #f0f0f0, #c9ccd4); color: #1a2233;
  font-family: var(--mono); font-size: 11px; font-weight: 700; }
.ball.red { background: radial-gradient(circle at 35% 30%, var(--red), #9e2727); color: #fff; }
.empty-state { color: var(--text-dim); font-size: 13px; padding: 20px 0; text-align: center; }

/* ===== 十组购买建议 ===== */
.rec-group { width: 100%; margin: 10px 0; }
.rec-group .rec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-group .rec-num { width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-family: var(--mono); flex-shrink: 0; }
.rec-balls { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.rec-balls .sep { color: var(--text-dim); margin: 0 2px; font-size: 12px; }
.rec-group .rec-meta { font-size: 12px; color: var(--text-dim); font-family: var(--mono); margin-top: 6px; }
.rec-rules {
  font-size: 12px; color: var(--text-dim); background: var(--bg-panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 6px 0 4px;
  line-height: 1.7;
}

/* ===== 回测表 ===== */
table.bt { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
table.bt th, table.bt td { border: 1px solid var(--line); padding: 8px 10px; text-align: center; }
table.bt th { background: var(--bg-panel-2); color: var(--text); font-size: 12px; }
table.bt td { font-family: var(--mono); }
table.bt td.hit-hi { color: var(--green); font-weight: 600; }
table.bt td.hit-lo { color: var(--red); }
.scroll-x { overflow-x: auto; }

/* ===== 数据表 ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; }
.data-table th { background: var(--bg-panel-2); font-size: 12px; position: sticky; top: 0; }
.data-table tbody { max-height: 380px; overflow: auto; }
.hist-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

.tabs { display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { padding: 8px 16px; font-size: 13px; color: var(--text-dim); cursor: pointer; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; }
.tab.active { color: var(--text); background: var(--bg-panel); border-color: var(--line); font-weight: 600; }
.tab-view { display: none; }
.tab-view.active { display: block; }

footer { margin-top: 30px; color: var(--text-dim); font-size: 12px; text-align: center; padding: 20px 0; border-top: 1px solid var(--line); }

.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-family: var(--mono); }
.badge.red { background: rgba(230,69,69,.15); color: var(--red); }
.badge.green { background: rgba(63,191,127,.15); color: var(--green); }
.badge.amber { background: rgba(240,168,58,.15); color: var(--amber); }

@media (max-width: 768px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-box { height: 220px; }
  .topbar-inner { flex-wrap: wrap; }
}
