:root {
  --bg: #f2f3f5;
  --card: #fff;
  --text: #333;
  --muted: #888;
  --line: #e6e6e6;
  --head: #f3f4f6;
  --red: #e0362f;
  --blue: #2a5be8;
  --ball: #45b89f;
  --sum: #2e7d3e;
  --t-result: #3b5191;
  --t-trend: #5bc4f1;
  --t-stats: #9b1f82;
  --t-predict: #4ca983;
  --sub: #c4870c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
button { font: inherit; cursor: pointer; }
.wrap { max-width: 1024px; margin: 0 auto; padding: 0 12px; }
.red { color: var(--red); font-weight: normal; }

.topbar { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.topbar .wrap { display: flex; align-items: center; }
.logo { display: block; width: 100%; height: auto; }

.game-title { margin-top: 16px; background: #fff; text-align: center; padding: 10px; color: var(--red); font-weight: 600; border-bottom: 2px solid var(--red); }

.card { background: var(--card); margin-top: 10px; padding: 16px; text-align: center; }
.center { text-align: center; }
.latest { font-size: 17px; }
.pager { margin-top: 8px; display: inline-flex; gap: 6px; }
.pager button, .pager input { height: 30px; border: 1px solid #ccc; background: #fff; border-radius: 3px; }
.pager button { width: 46px; }
.pager button:disabled { color: #ccc; cursor: default; }
.pager input { width: 90px; text-align: center; color: #666; }

.countdown { font-size: 18px; color: #555; }
.cd-box { display: inline-block; min-width: 56px; padding: 2px 8px; margin: 0 4px; background: var(--red); color: #fff; font-size: 28px; border-radius: 2px; font-variant-numeric: tabular-nums; }
.cd-wait { color: var(--red); margin-left: 8px; }

.balls-wrap { position: relative; display: inline-block; }
.balls { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 56px; }
.ball { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; background: var(--ball); color: #fff; font-size: 34px; border-radius: 2px; }
.ball.sum { background: var(--sum); }
.op { font-size: 20px; font-weight: 600; }
.tag { width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; margin-left: 6px; }
.tag.blue { background: var(--blue); }
.tag.redbg { background: var(--red); }
.scratch { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); cursor: crosshair; touch-action: none; border-radius: 4px; }
.viewing { color: var(--muted); font-size: 13px; margin-top: 6px; min-height: 1em; }
.btn-red { background: var(--red); color: #fff; border: 0; border-radius: 3px; padding: 10px 28px; font-size: 18px; }
.btn-red.on { background: #888; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 10px; }
.tabs button { position: relative; border: 0; color: #fff; padding: 10px 0; font-size: 16px; }
.t-result { background: var(--t-result); }
.t-trend { background: var(--t-trend); }
.t-stats { background: var(--t-stats); }
.t-predict { background: var(--t-predict); }
.tabs button.active::after { content: ""; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); border: 9px solid transparent; border-bottom: 0; border-top-color: inherit; }
.t-result.active::after { border-top-color: var(--t-result); }
.t-trend.active::after { border-top-color: var(--t-trend); }
.t-stats.active::after { border-top-color: var(--t-stats); }
.t-predict.active::after { border-top-color: var(--t-predict); }

.panel { margin-top: 20px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl th { background: var(--head); font-weight: normal; color: #555; }
.tbl th, .tbl td { padding: 7px 6px; text-align: center; border: 1px solid var(--line); }
.tbl tbody tr:hover { background: #fafafa; }
.tbl .empty { color: var(--muted); padding: 24px; }

.scroll-x { overflow-x: auto; }
.trend { min-width: 640px; }
.trend td { border-left: 0; border-right: 0; }
.trend .gap td { color: #555; }
.badge { display: inline-block; min-width: 44px; padding: 3px 8px; border-radius: 3px; color: #fff; font-size: 13px; }
.badge.r { background: #d62525; }
.badge.b { background: var(--blue); }

.stats .pill { display: inline-block; min-width: 30px; padding: 2px 10px; border-radius: 14px; background: var(--blue); color: #fff; font-size: 13px; }
.stats td.num { color: var(--blue); }
.stats td.num.cold { color: var(--red); }

.subtabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.subtabs button { background: var(--sub); color: #fff; border: 0; padding: 8px 0; font-size: 16px; border-bottom: 3px solid transparent; }
.subtabs button.active { border-bottom-color: var(--red); }
.rate { text-align: center; color: #555; margin-bottom: 8px; }
.p-r { color: var(--red); }
.p-b { color: var(--blue); }
.hit { color: #2fa84f; font-weight: 700; }
.miss { color: var(--red); font-weight: 700; }
.note { color: var(--muted); font-size: 13px; text-align: center; }

.footer-note { text-align: left; color: var(--muted); font-size: 14px; margin: 20px 0 30px; }
.footer-note p { margin: 4px 0; }

.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff; padding: 8px 16px; border-radius: 4px; z-index: 10; }

@media (max-width: 600px) {
  body { font-size: 14px; }
  .card { padding: 14px 8px; }
  .ball, .tag { width: 36px; height: 36px; font-size: 22px; }
  .tag { font-size: 14px; margin-left: 0; }
  .op { font-size: 16px; }
  .balls { gap: 4px; flex-wrap: nowrap; }
  .cd-box { font-size: 22px; min-width: 44px; }
  .tbl th, .tbl td { padding: 6px 3px; }
  .tabs button, .subtabs button { font-size: 15px; }
  .subtabs { gap: 6px; }
}
