/* 前台与后台共用的外观。改配色、改间距只改这一个文件。 */

:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #fbfbfa;
  --ink: #16181d;
  --ink-2: #5f6570;
  --ink-3: #8b909a;
  --line: #e3e4e1;
  --line-2: #eef0ec;
  --red: #c8102e;
  --red-soft: #fcecee;
  --green: #0f7b4f;
  --green-soft: #e7f3ed;
  --amber: #9a6500;
  --amber-soft: #fbf1de;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --surface: #171a1e;
    --surface-2: #1c2025;
    --ink: #eceef1;
    --ink-2: #9aa1ac;
    --ink-3: #6f7681;
    --line: #272c33;
    --line-2: #21262c;
    --red: #f0425c;
    --red-soft: #2b171c;
    --green: #35b37c;
    --green-soft: #14261d;
    --amber: #d9a03f;
    --amber-soft: #2a2114;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom);
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 14px; }
h2 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: .01em; }
a { color: var(--red); text-decoration: none; }
a:active { opacity: .6; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.note { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }
footer { padding: 20px 0 40px; font-size: 12px; color: var(--ink-3); line-height: 1.8; }

/* ---------- 顶栏 ---------- */
.statusbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.statusbar-in { display: flex; align-items: center; gap: 10px; height: 52px; }
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand span { color: var(--red); }
.period {
  font-size: 12px; color: var(--ink-2); padding: 3px 7px;
  border: 1px solid var(--line); border-radius: 999px; white-space: nowrap;
}
.spacer { flex: 1; }
.clock { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.clock .lbl { font-size: 11px; color: var(--ink-3); }
.clock .val { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.clock.closed .val { color: var(--amber); }
.demo-flag {
  font-size: 11px; color: var(--amber); background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
/* 接口连上了才换成这个。两个标记共用同一个位置，只是颜色和字不一样。 */
.live-flag {
  font-size: 11px; color: var(--green); background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}

/* ---------- 分区 ---------- */
.band { padding: 18px 0 22px; border-bottom: 1px solid var(--line); }
.band-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.band-head p { margin: 0; font-size: 12px; color: var(--ink-3); }

/* ---------- 指标条 ---------- */
.summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 14px;
}
.summary.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 后台那张是五格。窄一点就先三格、再两格，别让数字被挤得换行 */
.summary.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { background: var(--surface); padding: 10px 12px; }
.stat .k { font-size: 11px; color: var(--ink-3); }
.stat .v { font-size: 18px; font-weight: 700; margin-top: 2px; }
.stat .v small { font-size: 11px; font-weight: 500; color: var(--ink-3); }
.stat .v.pos { color: var(--green); }
.stat .v.neg { color: var(--red); }
.warnbar {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 22%, transparent);
  color: var(--ink); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
.warnbar b { color: var(--red); }
/* display:flex 会盖掉 hidden 属性，必须显式关掉，否则提醒条一直显示 */
.warnbar[hidden] { display: none; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-2); }
th { font-size: 11px; color: var(--ink-3); font-weight: 500; background: var(--surface-2); }
th:first-child, td:first-child { padding-left: 12px; }
th:last-child, td:last-child { padding-right: 12px; text-align: right; }
tbody tr { background: var(--surface); }
/* 窄屏时表格横向滚动，不撑宽整页 */
.tablewrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tablewrap table { min-width: 540px; }
/* 列数少的表不需要撑到 540，窄屏直接铺满 */
.tablewrap.narrow table { min-width: 0; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.ball {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--red); color: #fff; font-weight: 700; font-size: 13px;
}
.hash { font-size: 12px; color: var(--ink-2); }
/* 四种状态：已派彩 / 待派彩 / 没中 / 还没开奖。颜色不同，形状一样。 */
.tag-ok, .tag-wait, .tag-none, .tag-open {
  font-size: 11px; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.tag-ok { background: var(--green-soft); color: var(--green); }
.tag-wait { background: var(--amber-soft); color: var(--amber); }
.tag-none { background: var(--line-2); color: var(--ink-3); }
.tag-open { background: var(--line-2); color: var(--ink-2); }

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-block; padding: 11px 12px; border-radius: var(--radius); font-size: 14px;
  font-weight: 600; text-align: center; border: 1px solid var(--line); background: var(--surface-2);
}
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn:active { opacity: .75; }
.field {
  width: 100%; padding: 11px 12px; border-radius: var(--radius); font-size: 15px;
  border: 1px solid var(--line); background: var(--surface);
}
.field:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
/* 已经派奖的那一期锁住：填不进去也按不动，原因写在下面那行说明里 */
.field:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; }
.field:disabled:focus { outline: none; }
.kv { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.kv div { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 600; }
.kv .v.warn { color: var(--amber); }

/* ---------- 记录查询与分页 ---------- */
.search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.search .field { flex: 1 1 340px; min-width: 0; font-size: 14px; }
.search .btn { flex: none; }
.search-hint { width: 100%; font-size: 12px; color: var(--ink-3); margin: 0; }
.search-hint button { color: var(--red); font-size: 12px; }
.search-hint button:active { opacity: .6; }
.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 16px 14px; font-size: 13px; color: var(--ink-2); background: var(--surface-2);
}
.empty b { color: var(--ink); }
.empty.bad { border-color: color-mix(in srgb, var(--red) 30%, transparent); background: var(--red-soft); }
.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: 10px; font-size: 12px; color: var(--ink-3);
}
.pager button {
  padding: 6px 11px; font-size: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}
.pager button[disabled] { opacity: .4; cursor: default; }
/* 低于最低下注额、没算下注的那几笔。它们不是下注，所以视觉上比上面那张表轻一档，
   但必须看得见：没有客服，转少了的人自己来查要有一句实话。 */
.lownote { font-size: 12px; color: var(--ink-3); margin: 16px 0 8px; line-height: 1.6; }

/* ---------- 响应式 ---------- */
@media (max-width: 899px) {
  /* 窄屏下顶栏改两行，保证倒计时不被切掉 */
  .statusbar-in { flex-wrap: wrap; height: auto; padding: 7px 0; column-gap: 8px; row-gap: 5px; }
  .statusbar-in .spacer { display: none; }
  .clock { margin-left: auto; }
  .period { order: 3; }
  .demo-flag, .live-flag { order: 4; }
  .summary .stat .v { font-size: 16px; }
}
@media (max-width: 1279px) {
  .summary.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* 五格排不满三列会剩一个空格，露出的是格子的底色。最后一格补上去 */
  .summary.five .stat:last-child { grid-column: span 2; }
}
@media (max-width: 1023px) {
  .summary.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary.five .stat:last-child { grid-column: span 2; }
}
@media (max-width: 640px) {
  /* 次要列在窄屏隐藏，表格就不需要横向滚动 */
  .tablewrap { overflow-x: visible; }
  .tablewrap table { min-width: 0; }
  th, td { padding: 8px 6px; font-size: 12px; }
  th:first-child, td:first-child { padding-left: 9px; }
  th:last-child, td:last-child { padding-right: 9px; }
  .hide-sm { display: none; }
  /* 标题和副标题挤不下时各占一行，别把标题挤断 */
  .band-head { flex-wrap: wrap; row-gap: 2px; }
  .band-head h2 { flex: 1 1 100%; }
}
@media (min-width: 900px) {
  .statusbar-in { height: 56px; }
}
