:root {
  --bg: #0f1115;
  --bg2: #151922;
  --card: #171b24;
  --card2: #1e232f;
  --line: #262c39;
  --text: #e8ecf4;
  --muted: #8b93a7;
  --gold: #f5c451;
  --gold2: #ffdf8a;
  --red: #ff5a5f;
  --blue: #3d7eff;
  --green: #22c55e;
  --purple: #a855f7;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(180deg, #14181f, #0f1115);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), #e39b2f);
  color: #241a05; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.title { font-size: 16px; font-weight: 700; }
.subtitle { font-size: 11px; color: var(--muted); }

.vip-badge {
  background: linear-gradient(135deg, var(--gold2), #e0a53c);
  color: #2b1e04; font-size: 12px; font-weight: 800;
  padding: 5px 12px; border-radius: 999px;
}
.hidden { display: none !important; }

main { padding: 14px 14px 20px; max-width: 640px; margin: 0 auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700; margin-bottom: 12px; color: #fff;
}
.section-sub { font-size: 12px; color: var(--muted); margin: 8px 0 6px; }

/* 形态标注：纯展示（和值 / 区间比 / 奇偶比），不影响中奖概率 */
.shape-tag {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
}

.row { margin-bottom: 14px; }
.row-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.tiny { font-size: 11px; opacity: .8; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  flex: 1; min-width: 52px;
  padding: 9px 0; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card2);
  color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s;
}
.chip.active { background: linear-gradient(135deg, var(--gold), #e5a93a); color: #2b1e04; border-color: transparent; }
.lock { font-size: 10px; background: rgba(0,0,0,.18); border-radius: 6px; padding: 1px 4px; margin-left: 2px; }

.btn {
  display: block; width: 100%; padding: 12px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
  font-size: 15px; font-weight: 700; cursor: pointer; text-align: center;
  text-decoration: none; margin-top: 8px;
}
.btn.primary { background: linear-gradient(135deg, var(--gold), #e09a2b); color: #2b1e04; border-color: transparent; }
.btn.big { padding: 15px; font-size: 16px; margin-top: 4px; }
.btn.ghost { background: transparent; }
.btn:active { transform: scale(.985); opacity: .9; }

.mini-btn {
  background: rgba(245,196,81,.14); color: var(--gold2);
  border: 1px solid rgba(245,196,81,.3);
  border-radius: 10px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}

.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.mt { margin-top: 10px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 0; }

/* 号码球 */
.balls { display: flex; gap: 8px; flex-wrap: wrap; }
.ball {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.ball.z0 { background: linear-gradient(145deg, #ff6b6b, #d93838); }
.ball.z1 { background: linear-gradient(145deg, #5b95ff, #2a5fd6); }
.ball.z2 { background: linear-gradient(145deg, #3ddc84, #16a34a); }

/* 波色配色（红波/蓝波/绿波）—— 号码池为 49 时启用 */
.ball.wR { background: linear-gradient(145deg, #ff6b6b, #d93838); }
.ball.wB { background: linear-gradient(145deg, #5b95ff, #2a5fd6); }
.ball.wG { background: linear-gradient(145deg, #3ddc84, #16a34a); }

/* 历史记录里的小号球（按波色着色） */
.mini-balls { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.mini-ball {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff; font-style: normal;
}
.mini-ball.wR { background: linear-gradient(145deg, #ff6b6b, #d93838); }
.mini-ball.wB { background: linear-gradient(145deg, #5b95ff, #2a5fd6); }
.mini-ball.wG { background: linear-gradient(145deg, #3ddc84, #16a34a); }
.mini-ball.z0 { background: linear-gradient(145deg, #ff6b6b, #d93838); }
.mini-ball.z1 { background: linear-gradient(145deg, #5b95ff, #2a5fd6); }
.mini-ball.z2 { background: linear-gradient(145deg, #3ddc84, #16a34a); }

/* 波色图例 */
.wave-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
.wave-legend span { display: inline-flex; align-items: center; gap: 5px; }
.wave-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.wave-legend .lg-r { background: linear-gradient(145deg, #ff6b6b, #d93838); }
.wave-legend .lg-b { background: linear-gradient(145deg, #5b95ff, #2a5fd6); }
.wave-legend .lg-g { background: linear-gradient(145deg, #3ddc84, #16a34a); }

/* 数据自动重检（后台） */
.audit-verdict {
  margin: 6px 0 8px; padding: 8px 10px; border-radius: 8px;
  background: rgba(61, 220, 132, .08); border: 1px solid rgba(61, 220, 132, .25);
  font-size: 12px; line-height: 1.6; color: var(--text);
}
.audit-verdict.warn {
  background: rgba(255, 215, 106, .10); border-color: rgba(255, 215, 106, .35);
}
.audit-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 12px;
}
.audit-name { min-width: 116px; font-weight: 600; color: var(--text); }
.audit-meta { flex: 1; color: var(--muted); font-size: 11px; min-width: 150px; }
.audit-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.audit-flag { min-width: 78px; text-align: right; font-size: 11px; }
.ball.z3 { background: linear-gradient(145deg, #c084fc, #8b31d6); }
.ball.z4 { background: linear-gradient(145deg, #f7d068, #d08f1e); color: #2b1e04; }
.ball.roll { animation: roll .5s ease; }
@keyframes roll { from { transform: translateY(-8px) scale(.8); opacity: .3; } }

.group-item {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; margin-bottom: 10px;
}
.group-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
.group-reason { font-size: 12px; color: #b9c0d0; margin-top: 10px; line-height: 1.7; }

/* 场次错开提示里的文字按钮 */
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: #8ab4ff; font-size: 12px; text-decoration: underline;
}

/* 走势判定面板 */
.trend-perf { display: flex; gap: 5px; flex-wrap: wrap; margin: 8px 0 12px; }
.trend-chip {
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.10); color: var(--muted);
}
.trend-chip.up { border-color: rgba(61,220,132,.35); color: #3ddc84; background: rgba(61,220,132,.08); }
.trend-chip.down { border-color: rgba(255,138,142,.35); color: #ff8a8e; background: rgba(255,138,142,.08); }
.trend-grid { display: flex; gap: 5px; flex-wrap: wrap; }
/* 摇号结果里的走势构成：一行一个走势类型，后面跟具体号码 */
.trend-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.trend-nums { font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.trend-num {
  width: 54px; padding: 4px 2px; border-radius: 6px; text-align: center;
  background: rgba(255,255,255,.04); font-size: 11px; line-height: 1.4;
}
.trend-num b { display: block; font-size: 13px; }
.trend-num.up b { color: #3ddc84; }
.trend-num.down b { color: #ff8a8e; }
.trend-num .nm { color: var(--muted); font-size: 10px; }

/* 8 维度检验凭证（「全军覆没」出号标准） */
.audit-box { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); }
.audit-line { font-size: 12px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.audit-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.audit-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.10); color: var(--muted);
}
.audit-chip.ok { border-color: rgba(61,220,132,.35); color: #3ddc84; background: rgba(61,220,132,.08); }
.audit-chip.no { border-color: rgba(255,138,142,.35); color: #ff8a8e; background: rgba(255,138,142,.08); }

.disclaimer { font-size: 11px; color: #6f7789; margin-top: 10px; line-height: 1.6; }
.doc { font-size: 12.5px; color: #b9c0d0; line-height: 1.8; }
.doc p { margin: 8px 0; }
.doc code { background: #222836; padding: 1px 5px; border-radius: 5px; color: var(--gold2); }

.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--card2); border-radius: 12px; padding: 10px 12px;
}
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 800; color: var(--gold2); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); font-weight: 600; text-align: right; }

.verdict {
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: rgba(61,126,255,.1); border: 1px solid rgba(61,126,255,.25);
  font-size: 12.5px; color: #cfd8ea; line-height: 1.7;
}

.freq-chart {
  display: grid; grid-template-columns: repeat(49, 1fr); gap: 1px;
  height: 110px; align-items: end;
}
.freq-chart .bar { background: #3a4256; border-radius: 1px; min-height: 2px; position: relative; }
.freq-chart .bar.up { background: var(--red); }
.freq-chart .bar.down { background: var(--blue); }
.legend { font-size: 11px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; }
.dot.hot { background: var(--red); } .dot.cold { background: var(--blue); } .ml { margin-left: 12px; }

.ball-list { display: flex; gap: 6px; flex-wrap: wrap; }
.ball-sm {
  min-width: 34px; height: 30px; padding: 0 6px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; background: #2a3142;
}
.ball-sm.hot { background: linear-gradient(145deg,#ff6b6b,#d93838); }
.ball-sm.cold { background: linear-gradient(145deg,#5b95ff,#2a5fd6); }

/* 特码：金色，与主号（蓝色系）明显区分 */
.ball.special {
  background: linear-gradient(145deg, #ffd76a, #e0a11b);
  color: #3a2a00;
  box-shadow: 0 2px 8px rgba(224,161,27,.35), inset 0 1px 0 rgba(255,255,255,.5);
}
.ball.special::after {
  content: '特';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 10px;
  background: #e0a11b;
  color: #3a2a00;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
}
.sp { color: var(--gold2, #ffd76a); font-weight: 700; }

.table { font-size: 12.5px; }
.tr { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #212735; }
.tr:last-child { border-bottom: none; }
.tr .c1 { color: var(--muted); }
.tr .c2 { font-weight: 600; }
.tr .c3 { color: var(--gold2); font-weight: 700; }
.tr.head { color: var(--muted); font-size: 11px; }

/* 最多保留 20 条，超出后列表内部滚动，避免页面被撑得过长 */
.history-list { max-height: 340px; overflow-y: auto; }
.history-list .h-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #212735; font-size: 12.5px;
}
.history-list .h-item:last-child { border-bottom: none; }

.input, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; color: var(--text);
  font-size: 14px; outline: none; font-family: inherit;
}
.input:focus, textarea:focus { border-color: var(--gold); }
input[type=range] { width: 100%; accent-color: var(--gold); }

.vip-card { background: linear-gradient(160deg, #2a2415, #171b24); border-color: rgba(245,196,81,.25); }

.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.plan {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; cursor: pointer; transition: .15s;
}
.plan.active { border-color: var(--gold); background: rgba(245,196,81,.12); }
.plan .pn { font-size: 14px; font-weight: 700; }
.plan .pp { color: var(--gold2); font-size: 20px; font-weight: 800; margin: 2px 0; }
.plan .pd { font-size: 11px; color: var(--muted); }
.pay-box { max-width: 420px; margin: 0 auto; padding: 18px 14px 40px; }
.pay-amount { font-size: 34px; font-weight: 800; color: var(--gold2); text-align: center; margin: 6px 0; }
.code-line { font-size: 20px; font-weight: 800; letter-spacing: 2px; text-align: center; color: var(--gold2); margin: 10px 0; font-family: ui-monospace, Menlo, Consolas, monospace; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(20,24,31,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; padding: 8px 0 6px; background: none; border: none;
  color: var(--muted); font-size: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab i { font-style: normal; font-size: 19px; }
.tab.active { color: var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.88); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; width: 100%; max-width: 360px;
}

.admin-wrap { max-width: 720px; margin: 0 auto; padding: 16px 14px 40px; }
.admin-title { font-size: 18px; font-weight: 800; margin: 6px 0 14px; }
.login-box { max-width: 360px; margin: 18vh auto; }
.code-list { font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.code-list div { padding: 6px 0; border-bottom: 1px solid #212735; display: flex; justify-content: space-between; gap: 8px; }
.code-list span.used { color: #6f7789; text-decoration: line-through; }
.tag { font-size: 10px; padding: 2px 6px; border-radius: 6px; background: #2a3142; color: var(--muted); }
.tag.ok { background: rgba(34,197,94,.15); color: var(--green); }
.tag.no { background: rgba(255,90,95,.15); color: var(--red); }
.scroll { max-height: 320px; overflow: auto; }
