:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2129;
  --ink2: #4e5969;
  --muted: #86909c;
  --line: #e5e6eb;
  --line2: #f2f3f5;
  --brand: #d4232f;
  --brand-soft: #fdecee;
  --red: #e5323e;
  --blue: #2a6fdb;
  --orange: #f08a1c;
  --ok: #1f9d55;
  --hit-bg: #fff4d6;
  --seq0: #fde8e9; --seq1: #f9c3c6; --seq2: #f19197; --seq3: #e45a64; --seq4: #c42531;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 6px rgba(0,0,0,.04);
  --radius: 12px;
  --head-h: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --card: #1b1e24;
    --ink: #e8eaed;
    --ink2: #b8bec7;
    --muted: #7d8590;
    --line: #2c3039;
    --line2: #22262d;
    --brand: #f0545e;
    --brand-soft: #3a1f23;
    --red: #f0545e;
    --blue: #5b93ee;
    --orange: #f5a04a;
    --ok: #3fbf7a;
    --hit-bg: #3d3420;
    --seq0: #3a2226; --seq1: #5e2a31; --seq2: #8c3039; --seq3: #c23d48; --seq4: #f0606b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(16px + var(--safe-b));
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.tnum, .num { font-variant-numeric: tabular-nums; }
#share-img { position: absolute; width: 0; height: 0; overflow: hidden; opacity: 0; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.top-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; height: var(--head-h); padding: 0 12px; gap: 8px; }
.top .back { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 22px; line-height: 1; }
.top .back:active { background: rgba(255,255,255,.15); }
.top h1 { font-size: 17px; margin: 0; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .r { font-size: 13px; opacity: .9; padding: 6px 8px; border-radius: 8px; }
.games { display: flex; max-width: 1100px; margin: 0 auto; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.games::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.games a { flex: 1 0 auto; text-align: center; padding: 8px 8px 10px; font-size: 15px; opacity: .8; position: relative; white-space: nowrap; }
.games a.on { opacity: 1; font-weight: 600; }
.games a.on::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 20px; height: 3px; margin-left: -10px; background: #fff; border-radius: 2px; }

.tabs {
  position: sticky; top: var(--head-h); z-index: 15; background: var(--card);
  display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.tabs-in { display: flex; max-width: 1100px; margin: 0 auto; width: 100%; }
.tabs a { flex: 1 0 auto; text-align: center; padding: 11px 10px; font-size: 15px; color: var(--ink2); position: relative; white-space: nowrap; }
.tabs a.on { color: var(--brand); font-weight: 600; }
.tabs a.on::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 24px; height: 3px; margin-left: -12px; background: var(--brand); border-radius: 2px; }

main { max-width: 1100px; margin: 0 auto; padding: 12px; }
main.narrow { max-width: 760px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card > h2, .card > .hd { margin: 0 0 10px; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card > .hd .more { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: normal; }
.sub { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.ink2 { color: var(--ink2); }
.small { font-size: 13px; }
.red { color: var(--red); }
.blue { color: var(--blue); }
.ok { color: var(--ok); }
.b { font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp { flex: 1; }
.mt { margin-top: 10px; }
.center { text-align: center; }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

/* ---------- 号码球 ---------- */
.balls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ball {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff; background: var(--red); font-variant-numeric: tabular-nums; flex: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.ball.b { background: var(--blue); }
.ball.o { background: var(--orange); }
.ball.g { background: transparent; color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line); }
.ball.sm { width: 24px; height: 24px; font-size: 12px; }
.ball.lg { width: 36px; height: 36px; font-size: 17px; }
.ball.hit { outline: 2px solid var(--orange); outline-offset: 1px; }
.balls .plus { color: var(--muted); margin: 0 2px; }
.kl8 .balls { gap: 5px; }
.kl8 .ball { width: 27px; height: 27px; font-size: 13px; }

/* ---------- 首页 ---------- */
.game-card .hd .name { font-size: 17px; }
.game-card .meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.game-card .figs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.fig { background: var(--line2); border-radius: 8px; padding: 8px 10px; }
.fig .k { font-size: 12px; color: var(--muted); }
.fig .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.next { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink2); flex-wrap: wrap; }
.cd { color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.quick a { text-align: center; font-size: 13px; padding: 7px 0; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
@media (min-width: 760px) {
  .home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .home-grid .card { margin: 0; }
}

/* ---------- 控件 ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; font-size: 13px;
  color: var(--ink2); cursor: pointer; white-space: nowrap; line-height: 1.6;
}
.chip.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 8px;
  background: var(--brand); color: #fff; padding: 9px 16px; font-size: 15px; cursor: pointer; line-height: 1.3;
}
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.line { background: transparent; color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }
.btn:active { opacity: .8; }
.btn[disabled] { opacity: .45; }
input[type=text], input[type=number], input[type=date], input[type=search], select {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 7px 10px; font-size: 15px; min-width: 0;
  -webkit-appearance: none; appearance: none;
}
select { padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 12px center, right 7px center; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label.ck { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink2); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.field input, .field select { width: 100%; }
.seg { display: inline-flex; background: var(--line2); border-radius: 8px; padding: 2px; }
.seg a, .seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 13px; color: var(--ink2); cursor: pointer; }
.seg .on { background: var(--card); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- 列表 ---------- */
.list .item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line2); }
.list .item:last-child { border-bottom: 0; }
.list .item .iss { width: 78px; flex: none; }
.list .item .iss b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.list .item .iss span { font-size: 12px; color: var(--muted); }
.list .item .bd { flex: 1; min-width: 0; }
.list .item .ext { font-size: 12px; color: var(--muted); margin-top: 4px; }
.list .item .arr { color: var(--muted); flex: none; }
.list .item:active { background: var(--line2); }
.filters { display: flex; flex-direction: column; gap: 10px; }
.filters .row > input { flex: 1; }

/* ---------- 表格 ---------- */
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line2); text-align: center; font-size: 14px; }
.tbl th { color: var(--muted); font-weight: normal; font-size: 13px; background: var(--line2); white-space: nowrap; }
.tbl td.l, .tbl th.l { text-align: left; }
.tbl tr > td:first-child { white-space: nowrap; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.hit td { background: var(--hit-bg); }
.tbl th.sort { cursor: pointer; }
.tbl th.sort.on { color: var(--brand); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 走势图 ---------- */
.trend-wrap { position: relative; overflow: auto; -webkit-overflow-scrolling: touch; max-height: calc(100vh - 190px); border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.trend { border-collapse: separate; border-spacing: 0; width: auto; font-size: 12px; }
.trend th, .trend td { min-width: 22px; height: 22px; padding: 0; text-align: center; border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); white-space: nowrap; }
.trend thead th { position: sticky; top: 0; z-index: 4; background: var(--line2); color: var(--ink2); font-weight: 600; height: 26px; }
.trend thead tr:nth-child(2) th { top: 26px; }
.trend .c0 { position: sticky; left: 0; z-index: 3; background: var(--card); min-width: 46px; padding: 0 4px; color: var(--ink2); }
.trend thead .c0 { z-index: 5; background: var(--line2); }
.trend tfoot td { background: var(--line2); color: var(--ink2); font-size: 11px; }
.trend tfoot .c0 { background: var(--line2); font-size: 11px; }
.trend .miss { color: var(--muted); opacity: .6; font-size: 11px; }
.trend.nomiss .miss { color: transparent; }
.trend .zone-end { border-right: 2px solid var(--line); }
.trend .val { min-width: 34px; padding: 0 3px; color: var(--ink); }
.trend .val.w { min-width: 48px; }
.tb { display: inline-flex; width: 19px; height: 19px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 11px; position: relative; z-index: 2; }
.tb.r { background: var(--red); }
.tb.bl { background: var(--blue); }
.tb.o { background: var(--orange); }
.tb.sq { border-radius: 4px; }
.trend tr.sep td { border-bottom: 2px solid var(--line); }
.trend-svg { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; overflow: visible; }
.trend-svg polyline { fill: none; stroke-width: 1.5; stroke-linejoin: round; }
.trend tbody tr:hover td { background-color: var(--line2); }
.trend tbody tr:hover .c0 { background-color: var(--line2); }
.trend tbody td.lay { background: var(--hit-bg); }
.trend-opts { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }

/* ---------- 统计条形图 ---------- */
.bars { display: grid; gap: 2px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 140px; position: relative; cursor: default; }
.bar-col .bar { width: 72%; min-height: 2px; background: var(--red); border-radius: 4px 4px 0 0; }
.bar-col.blue .bar { background: var(--blue); }
.bar-col.dim .bar { opacity: .35; }
.bar-col .lab { font-size: 10px; color: var(--muted); margin-top: 3px; height: 14px; font-variant-numeric: tabular-nums; }
.bar-col .top-lab { font-size: 10px; color: var(--ink2); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 64px 1fr 74px; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.hbar .track { height: 12px; background: var(--line2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--red); border-radius: 0 4px 4px 0; }
.hbar .v { text-align: right; color: var(--ink2); font-variant-numeric: tabular-nums; }
.heat { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.heat div { aspect-ratio: 1 / 1; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; min-height: 30px; }
.heat div small { font-size: 10px; font-weight: normal; opacity: .85; }
.heat .h0 { background: var(--seq0); color: var(--ink); }
.heat .h1 { background: var(--seq1); color: var(--ink); }
.heat .h2 { background: var(--seq2); color: #fff; }
.heat .h3 { background: var(--seq3); color: #fff; }
.heat .h4 { background: var(--seq4); color: #fff; }
.legend-seq { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.legend-seq i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.tip {
  position: fixed; z-index: 60; pointer-events: none; background: rgba(29,33,41,.94); color: #fff; font-size: 12px;
  padding: 6px 9px; border-radius: 6px; line-height: 1.5; max-width: 220px; display: none;
}

/* ---------- 选号盘 ---------- */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.picker.d10 { grid-template-columns: repeat(10, 1fr); }
.pk {
  height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--red);
  font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-variant-numeric: tabular-nums; position: relative; user-select: none; -webkit-user-select: none; padding: 0;
  aspect-ratio: 1 / 1; height: auto; max-width: 44px; width: 100%; justify-self: center;
}
.picker.bl .pk { color: var(--blue); }
.pk.on { background: var(--red); border-color: var(--red); color: #fff; }
.picker.bl .pk.on { background: var(--blue); border-color: var(--blue); }
.pk.dan { background: var(--orange); border-color: var(--orange); color: #fff; }
.pk.dan::after { content: "胆"; position: absolute; top: -6px; right: -6px; font-size: 9px; background: var(--ink); color: #fff; border-radius: 6px; padding: 0 3px; line-height: 14px; }
.pick-hd { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; font-size: 14px; flex-wrap: wrap; }
.pick-hd:first-child { margin-top: 0; }
.pick-hd .sp { flex: 1; }
.pick-hd a { color: var(--muted); font-size: 13px; }
.sumbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: var(--line2); border-radius: 8px; margin-top: 12px; font-size: 14px; }
.sumbar b { color: var(--brand); }

/* ---------- 兑奖结果 ---------- */
.win-banner { border-radius: 10px; padding: 14px; text-align: center; margin-bottom: 10px; background: var(--line2); }
.win-banner.yes { background: var(--brand-soft); color: var(--brand); }
.win-banner .big { font-size: 22px; font-weight: 700; }
.bet-line { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.bet-line:last-child { border-bottom: 0; }
.bet-line .idx { width: 22px; color: var(--muted); font-size: 12px; }
.bet-line .act { margin-left: auto; display: flex; gap: 6px; }
.bet-line.col { flex-direction: column; align-items: stretch; gap: 6px; }
.bet-line.col .row { gap: 6px; }
.bet-txt { font-size: 14px; font-variant-numeric: tabular-nums; word-break: break-word; color: var(--ink); }
.bet-line.col .act { justify-content: flex-end; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--line2); color: var(--ink2); line-height: 18px; white-space: nowrap; }
.tag.red { background: var(--brand-soft); color: var(--brand); }
.tag.ok { background: rgba(31,157,85,.12); color: var(--ok); }

/* ---------- 规则/页脚 ---------- */
.prose { font-size: 14px; color: var(--ink2); line-height: 1.75; }
.prose h3 { font-size: 15px; color: var(--ink); margin: 14px 0 6px; }
.prose p { margin: 6px 0; }
.prose ul { padding-left: 20px; margin: 6px 0; }
footer { max-width: 1100px; margin: 8px auto 0; padding: 0 16px 16px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.8; }
.toast {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); background: rgba(29,33,41,.92); color: #fff;
  padding: 10px 18px; border-radius: 8px; z-index: 100; font-size: 14px; pointer-events: none; transition: opacity .2s;
}
.loading { text-align: center; padding: 40px 0; color: var(--muted); }
.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -4px; margin-right: 6px; }
@keyframes sp { to { transform: rotate(360deg); } }
.detail-nav { display: flex; gap: 8px; }
.detail-nav .btn { flex: 1; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.kv .fig .v { font-size: 15px; }
.modal-mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 560px; border-radius: 14px 14px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); max-height: 80vh; overflow: auto; }
.modal h3 { margin: 0 0 10px; font-size: 16px; }
.modal textarea { width: 100%; min-height: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: 13px/1.6 ui-monospace, Menlo, monospace; background: var(--bg); color: var(--ink); }
@media (min-width: 560px) { .modal-mask { align-items: center; } .modal { border-radius: 14px; } }
@media (max-width: 380px) {
  .ball { width: 27px; height: 27px; font-size: 13px; }
  .kl8 .ball { width: 25px; height: 25px; font-size: 12px; }
  .list .item .iss { width: 70px; }
  main { padding: 10px; }
  .card { padding: 12px; }
}
