:root {
  --bg: #080b10;
  --bg-soft: #0d1219;
  --panel: linear-gradient(180deg, #151d26 0%, #101720 100%);
  --panel-solid: #121a23;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .13);
  --txt: #e8eef5;
  --txt-2: #a7b4c2;
  --txt-3: #6b7a88;
  --accent: #ff5a4d;
  --accent-2: #ffab3d;
  --cyan: #34d8d0;
  --green: #35d07f;
  --blue: #4c9eff;
  --radius: 16px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .9);
}

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

html, body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(255, 90, 77, .10), transparent 60%),
    radial-gradient(760px 380px at 92% -12%, rgba(52, 216, 208, .07), transparent 62%);
  background-repeat: no-repeat;
}

.wrap { max-width: 1220px; margin: 0 auto; padding: 0 20px 60px; }

/* ---------- 头部 ---------- */
header.top {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(8, 11, 16, .82);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1220px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto;
  background: linear-gradient(145deg, #ff6a4d, #d92b1f);
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px; letter-spacing: -.5px;
  box-shadow: 0 8px 22px -8px rgba(255, 90, 77, .8), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brand p { font-size: 11.5px; color: var(--txt-3); letter-spacing: .8px; }

.chips { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  color: var(--txt-2);
  white-space: nowrap;
}
.chip b { color: var(--txt); font-weight: 650; font-variant-numeric: tabular-nums; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(53, 208, 127, .15); }
.dot.warn { background: var(--accent-2); box-shadow: 0 0 0 3px rgba(255, 171, 61, .15); }

/* ---------- 标签页 ---------- */
nav.tabs {
  display: flex; gap: 6px; padding: 16px 0 20px; flex-wrap: wrap;
}
nav.tabs button {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  background: transparent; color: var(--txt-2);
  padding: 9px 18px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  transition: .18s; font-family: inherit;
}
nav.tabs button:hover { color: var(--txt); background: rgba(255, 255, 255, .04); }
nav.tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 90, 77, .22), rgba(255, 90, 77, .10));
  border-color: rgba(255, 90, 77, .42);
  box-shadow: 0 8px 24px -14px rgba(255, 90, 77, .9);
}

.tab-pane { display: none; animation: fade .28s ease; }
.tab-pane.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card h3 {
  font-size: 13px; font-weight: 650; color: var(--txt-2);
  letter-spacing: 1.2px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.card h3::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.card h3 .sub { margin-left: auto; font-size: 11.5px; color: var(--txt-3); text-transform: none; letter-spacing: 0; font-weight: 500; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1.15fr .85fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g7 { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.mt16 { margin-top: 16px; }

/* ---------- 期号条 ---------- */
.issue-bar {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  padding: 16px 22px; margin-bottom: 16px;
  background: linear-gradient(100deg, rgba(255, 90, 77, .13), rgba(255, 171, 61, .05) 42%, transparent 70%), var(--panel-solid);
  border: 1px solid rgba(255, 90, 77, .22);
  border-radius: var(--radius);
}
.issue-bar .k { font-size: 11.5px; color: var(--txt-3); letter-spacing: .6px; }
.issue-bar .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.issue-bar .v.accent { color: var(--accent-2); font-size: 20px; letter-spacing: .5px; }

/* ---------- 号码球 ---------- */
.ball {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 750; color: #fff;
  font-variant-numeric: tabular-nums;
  background: radial-gradient(circle at 32% 26%, #ff9a8a 0%, #f04b3c 45%, #a91d13 100%);
  box-shadow: 0 6px 14px -6px rgba(240, 75, 60, .85), inset 0 -3px 8px rgba(0, 0, 0, .3), inset 0 2px 4px rgba(255, 255, 255, .35);
}
.ball.sm { width: 30px; height: 30px; font-size: 14px; }
.ball.ghost {
  background: rgba(255, 255, 255, .05); color: var(--txt-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.ball.cyan { background: radial-gradient(circle at 32% 26%, #8ff5ef, #22b8b0 45%, #0b6b66 100%); box-shadow: 0 6px 14px -6px rgba(52, 216, 208, .7), inset 0 -3px 8px rgba(0, 0, 0, .25); }
.balls { display: flex; gap: 7px; align-items: center; }

/* 直选注单 */
.direct-list { display: flex; flex-wrap: wrap; gap: 10px; }
.ticket {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 13px 8px 9px; border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line);
  transition: .18s;
}
.ticket:hover { border-color: rgba(255, 90, 77, .4); background: rgba(255, 90, 77, .07); transform: translateY(-1px); }
.ticket .idx { font-size: 11px; color: var(--txt-3); font-variant-numeric: tabular-nums; min-width: 14px; }
.ticket .num {
  font-size: 19px; font-weight: 750; letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #ffb4a8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ticket .pp { font-size: 11px; color: var(--txt-3); font-variant-numeric: tabular-nums; }
.ticket.top1 { border-color: rgba(255, 171, 61, .45); background: rgba(255, 171, 61, .09); }

/* ---------- 指标 / 键值 ---------- */
.kv { display: flex; flex-direction: column; gap: 11px; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kv-row .k { color: var(--txt-2); font-size: 13px; }
.kv-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.big-num { font-size: 30px; font-weight: 780; line-height: 1.1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--txt-3); line-height: 1.7; }
.hint b { color: var(--txt-2); font-weight: 600; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 650;
  background: rgba(76, 158, 255, .14); color: #8bc0ff;
  border: 1px solid rgba(76, 158, 255, .25);
}
.badge.ok { background: rgba(53, 208, 127, .13); color: var(--green); border-color: rgba(53, 208, 127, .28); }
.badge.bad { background: rgba(255, 90, 77, .13); color: #ff8b80; border-color: rgba(255, 90, 77, .26); }
.badge.gold { background: rgba(255, 171, 61, .14); color: var(--accent-2); border-color: rgba(255, 171, 61, .3); }

/* ---------- 概率条 ---------- */
.prob-group { display: flex; flex-direction: column; gap: 9px; }
.prob-title { font-size: 12px; color: var(--txt-3); margin-bottom: 2px; letter-spacing: .5px; }
.prow { display: flex; align-items: center; gap: 10px; }
.prow .pd { width: 16px; text-align: center; font-size: 12.5px; color: var(--txt-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.ptrack { flex: 1; height: 8px; border-radius: 5px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.pfill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, rgba(76, 158, 255, .55), rgba(52, 216, 208, .8)); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.pfill.hot { background: linear-gradient(90deg, #ff8b3d, #ff4b3c); }
.prow .pv { width: 44px; text-align: right; font-size: 11.5px; color: var(--txt-3); font-variant-numeric: tabular-nums; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; white-space: nowrap; }
th { font-size: 11.5px; color: var(--txt-3); font-weight: 600; letter-spacing: .6px; background: rgba(255, 255, 255, .025); border-bottom: 1px solid var(--line); text-transform: uppercase; }
tbody tr { border-bottom: 1px solid rgba(255, 255, 255, .04); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .028); }
td.num { font-variant-numeric: tabular-nums; }

/* ---------- 按钮 / 表单 ---------- */
button.btn {
  appearance: none; cursor: pointer; font-family: inherit;
  padding: 10px 20px; border-radius: 11px; font-size: 13.5px; font-weight: 650;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .05); color: var(--txt);
  transition: .18s; display: inline-flex; align-items: center; gap: 8px;
}
button.btn:hover { background: rgba(255, 255, 255, .09); transform: translateY(-1px); }
button.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.btn.primary {
  background: linear-gradient(180deg, #ff6a52, #e0341f);
  border-color: rgba(255, 120, 90, .5);
  box-shadow: 0 10px 26px -14px rgba(255, 90, 77, 1);
}
button.btn.primary:hover { filter: brightness(1.08); }
button.btn.ghost { background: transparent; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

select, input[type=text] {
  font-family: inherit; font-size: 13px; color: var(--txt);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 9px 12px; outline: none;
}
select:focus, input[type=text]:focus { border-color: rgba(255, 90, 77, .5); }
textarea {
  width: 100%; min-height: 120px; resize: vertical;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px;
  color: var(--txt); background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px; outline: none;
  line-height: 1.7;
}

/* ---------- 提示条 ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: 12px; font-size: 12.5px; line-height: 1.7;
  background: rgba(255, 171, 61, .07); border: 1px solid rgba(255, 171, 61, .2); color: #e6c48c;
}
.notice.blue { background: rgba(76, 158, 255, .07); border-color: rgba(76, 158, 255, .2); color: #a9c9f0; }

/* ---------- 回测指标卡 ---------- */
.metric {
  padding: 14px 16px; border-radius: 13px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
}
.metric .m-name { font-size: 11.5px; color: var(--txt-3); margin-bottom: 6px; letter-spacing: .4px; }
.metric .m-rate { font-size: 24px; font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.metric .m-meta { font-size: 11.5px; color: var(--txt-3); margin-top: 5px; font-variant-numeric: tabular-nums; }
.metric .m-lift { font-size: 11.5px; font-weight: 650; margin-top: 4px; }
.up { color: var(--green); }
.down { color: #ff8b80; }
.flat { color: var(--txt-3); }

/* ---------- 权重条 ---------- */
.wrow { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.wrow .wn { width: 96px; font-size: 12.5px; color: var(--txt-2); flex: 0 0 auto; }
.wrow .wt { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.wrow .wf { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ff7a45, #ffab3d); }
.wrow .wv { width: 52px; text-align: right; font-size: 12px; color: var(--txt-3); font-variant-numeric: tabular-nums; }

/* ---------- 图表 ---------- */
.chart { width: 100%; height: 220px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--txt-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* 和值分布 */
.dist { display: flex; align-items: flex-end; gap: 3px; height: 92px; margin-top: 6px; }
.dist .bar { flex: 1; border-radius: 4px 4px 2px 2px; background: rgba(76, 158, 255, .35); position: relative; transition: .4s; min-height: 2px; }
.dist .bar.on { background: linear-gradient(180deg, #ff8b3d, #ff4b3c); box-shadow: 0 0 12px -2px rgba(255, 90, 77, .8); }
.dist-x { display: flex; gap: 3px; margin-top: 6px; }
.dist-x span { flex: 1; text-align: center; font-size: 9.5px; color: var(--txt-3); font-variant-numeric: tabular-nums; }

/* 进度 */
.progress { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.progress i { display: block; height: 100%; width: 30%; border-radius: 4px; background: linear-gradient(90deg, #ff7a45, #ffab3d); animation: slide 1.2s infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* 空态 */
.empty { text-align: center; padding: 60px 20px; color: var(--txt-3); }
.empty h2 { font-size: 18px; color: var(--txt-2); margin-bottom: 8px; font-weight: 650; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: rgba(20, 28, 38, .96); border: 1px solid var(--line-strong);
  color: var(--txt); padding: 11px 20px; border-radius: 12px; font-size: 13px;
  box-shadow: 0 20px 40px -18px #000; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 100; max-width: 82vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: rgba(255, 90, 77, .5); color: #ffb3ab; }

footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 0 0; font-size: 12px; color: var(--txt-3); line-height: 1.9; }
footer b { color: var(--txt-2); }

@media (max-width: 880px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .brand h1 { font-size: 15px; }
  .chips { width: 100%; margin-left: 0; }
  .ball { width: 34px; height: 34px; font-size: 16px; }
  .issue-bar { gap: 16px; }
  .wrap { padding: 0 14px 40px; }
}

/* 注数档位切换（命中率 = 覆盖组合数 / 1000，直接可调） */
.lvl { display: flex; gap: 6px; margin: 2px 0 13px; flex-wrap: wrap; }
.lvl button {
  font: inherit; font-size: 11.5px; cursor: pointer;
  padding: 5px 9px; border-radius: 7px; color: var(--txt-3);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
  transition: all .15s;
}
.lvl button:hover { color: var(--txt); border-color: var(--line-strong); }
.lvl button.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 2px 10px rgba(255, 90, 77, .25);
}
.direct-list.tall { max-height: 430px; overflow-y: auto; padding-right: 4px; }
.direct-list.tall::-webkit-scrollbar { width: 5px; }
.direct-list.tall::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

/* ---------- 手机适配强化 ---------- */
@media (max-width: 640px) {
  /* 标签页横向滚动，不再折行占空间 */
  nav.tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 12px 0 14px; scrollbar-width: none;
  }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs button { flex: 0 0 auto; padding: 8px 14px; font-size: 12.5px; }

  /* 状态条改成两列网格 */
  .issue-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
  .issue-bar > div { margin-left: 0 !important; }
  .issue-bar .v.accent { font-size: 18px; }

  .chip { font-size: 11px; padding: 5px 9px; }
  .chips { gap: 6px; }

  /* 档位按钮铺满行 */
  .lvl { gap: 5px; }
  .lvl button { flex: 1 1 0; padding: 6px 4px; font-size: 11px; text-align: center; white-space: nowrap; }

  /* 桌面表单在手机上收窄 */
  .btn-row { flex-wrap: wrap; }
  .btn-row input[type="text"], .btn-row select { width: 100% !important; }
  .card { padding: 16px 14px; }
  .metric .m-rate { font-size: 22px; }
  footer { font-size: 11.5px; }
}
