:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #1d2433;
  --muted: #6b7484;
  --line: #e3e7ee;
  --line-strong: #cfd5df;
  --accent: #1f5fbf;
  --accent-soft: #e8f0fc;
  --on-accent: #ffffff;
  --win: #d94141;
  --win-soft: #fde8e8;
  --draw: #d99a00;
  --draw-soft: #fff4d6;
  --lose: #23935a;
  --lose-soft: #e2f5ea;
  --hit: #fff1a8;
  --tier0: #2f6fd6; --tier1: #7a5af0; --tier2: #e07a1f;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .04);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --panel: #1a2029; --text: #e6e9ef; --muted: #98a1b1;
    --line: #2a313d; --line-strong: #3a4352; --accent: #6aa3ff; --accent-soft: #1d2b44; --on-accent: #0b1220;
    --win: #d13f3f; --win-soft: #3a1f22; --draw: #b98a12; --draw-soft: #3a3019;
    --lose: #36a96c; --lose-soft: #17322a; --hit: #4a4220;
    --tier0: #4f8ae6; --tier1: #8f78f2; --tier2: #d9893f;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --panel: #1a2029; --text: #e6e9ef; --muted: #98a1b1;
  --line: #2a313d; --line-strong: #3a4352; --accent: #6aa3ff; --accent-soft: #1d2b44; --on-accent: #0b1220;
  --win: #d13f3f; --win-soft: #3a1f22; --draw: #b98a12; --draw-soft: #3a3019;
  --lose: #36a96c; --lose-soft: #17322a; --hit: #4a4220;
  --tier0: #4f8ae6; --tier1: #8f78f2; --tier2: #d9893f;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
h1, h2, h3 { margin: 0; }
h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 18px; }
.brand p { font-size: 12px; }
.logo {
  width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  border: 0; background: none; color: var(--muted); padding: 8px 14px; border-radius: 8px;
  font: inherit; cursor: pointer;
}
.tab:hover { background: var(--accent-soft); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

main { max-width: 1320px; margin: 0 auto; padding: 18px 24px 48px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}

.loading { text-align: center; padding: 80px 0; color: var(--muted); }
.spinner {
  width: 32px; height: 32px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 7px; padding: 6px 9px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; font-family: Consolas, "Courier New", monospace; font-size: 13px; resize: vertical; }

.form-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr auto; gap: 18px; align-items: end; }
.field-group { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; }
.field-group h3 { grid-column: 1 / -1; grid-row: 1; white-space: nowrap; }
.field-group label { grid-row: 2; }
.field-group input { width: 100%; }
.field-group .fg-gap { grid-row: 2; }
/* 单场回查：终赔一行放在初赔下方 */
#singleForm .fg-spf-f { grid-column: 2; grid-row: 2; }
#singleForm .fg-rq-f { grid-column: 3; grid-row: 2; }
#singleForm .actions { grid-column: 4; grid-row: 1 / 3; align-self: end; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.vertical { flex-direction: column; align-items: stretch; }

.btn {
  font: inherit; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; white-space: nowrap; text-align: center;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn.file { display: block; }

.options { display: flex; gap: 18px; flex-wrap: wrap; align-items: end; padding: 12px 16px; }
.options label.inline { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.options select, .options input[type="number"] { width: auto; }
.options input[type="number"] { width: 84px; }
.options input[type="date"] { width: 150px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: none; font: inherit; padding: 5px 12px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--on-accent); }

.batch-input { display: grid; grid-template-columns: 1fr 180px; gap: 16px; }

/* 结果卡片 */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15px; }
.card-head .odds { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums;
}
.chip.warn { background: var(--draw-soft); color: var(--draw); }
.chip.gray { background: var(--bg); color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); position: sticky; top: 0; z-index: 1; }
td.left, th.left { text-align: left; }
/* 悬停行：普通单元格加底色，赛果着色的单元格保留原底色（白字仍可见）；整行上下描边、左侧色条标出 */
tbody tr:hover td:not(.r3c):not(.r1c):not(.r0c), tbody tr.pinned td:not(.r3c):not(.r1c):not(.r0c) { background: var(--accent-soft); }
tbody tr:hover td, tbody tr.pinned td { box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
tbody tr:hover td:first-child, tbody tr.pinned td:first-child { box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
tbody tr:hover td.hit, tbody tr.pinned td.hit { box-shadow: inset 0 0 0 2px var(--accent); }
/* 点击固定的行：左侧色条加粗，与悬停区分 */
tbody tr.pinned td:first-child { box-shadow: inset 5px 0 0 var(--accent), inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
tr.clickable { cursor: pointer; }
tr.dim td { color: var(--muted); }

.combo-table td { font-variant-numeric: tabular-nums; }
.combo-table .cond { color: var(--muted); font-size: 12px; }
.pct { display: block; font-size: 11px; color: var(--muted); }
.best { font-weight: 700; }
.best.r3 { color: var(--win); } .best.r1 { color: var(--draw); } .best.r0 { color: var(--lose); }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); min-width: 90px; }
.bar i { display: block; height: 100%; }
.bar .b3 { background: var(--win); } .bar .b1 { background: var(--draw); } .bar .b0 { background: var(--lose); }
.tag-size { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--bg); color: var(--muted); }

/* 赛果着色，沿用原表：胜红 平黄 负绿 */
.r3c { background: var(--win); color: #fff; font-weight: 600; }
.r1c { background: var(--draw); color: #fff; font-weight: 600; }
.r0c { background: var(--lose); color: #fff; font-weight: 600; }
.hit { box-shadow: inset 0 0 0 2px var(--accent); }
.res { display: inline-block; min-width: 22px; padding: 0 5px; border-radius: 4px; color: #fff; font-weight: 600; }
.res.r3 { background: var(--win); } .res.r1 { background: var(--draw); } .res.r0 { background: var(--lose); }
.res.rx { background: var(--line-strong); color: var(--muted); }

.records-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 8px; }
.records td { font-size: 13px; padding: 4px 6px; font-variant-numeric: tabular-nums; }
.records th { padding: 5px 6px; }
.records .grp { border-left: 2px solid var(--line-strong); }
/* 记录表：日期、场次固定在左侧；列分组可收起 */
.records tbody tr { cursor: pointer; }
.records .fx0, .records .fx1 { position: sticky; z-index: 1; background: var(--panel); }
.records .fx0 { left: 0; width: 84px; min-width: 84px; }
.records .fx1 { left: 84px; min-width: 76px; }
.records th.fx0, .records th.fx1 { z-index: 3; background: var(--bg); }
.records td.fx1, .records th.fx1 { box-shadow: inset -2px 0 0 var(--line-strong); }
tbody tr:hover td.fx1, tbody tr.pinned td.fx1 { box-shadow: inset -2px 0 0 var(--line-strong), inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
.rec-cols { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.col-chip { font: inherit; font-size: 12px; padding: 2px 10px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted); text-decoration: line-through; }
.col-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.records-wrap.hide-score .c-score, .records-wrap.hide-res .c-res, .records-wrap.hide-tgf .c-tgf, .records-wrap.hide-miss .c-miss,
.records-wrap.hide-o0 .c-o0, .records-wrap.hide-o1 .c-o1, .records-wrap.hide-o2 .c-o2, .records-wrap.hide-o3 .c-o3 { display: none; }
.pager { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: flex-end; padding: 10px 0 0; color: var(--muted); font-size: 13px; }
.pager-nav { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pager-nav .btn { min-width: 32px; padding: 3px 8px; }
.pager-nav .btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); opacity: 1; cursor: default; }
.pager-gap { padding: 0 2px; }
.pager-size, .pager-jump { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; }
.pager-size select { padding: 2px 6px; }
.pager-jump input { width: 64px; padding: 2px 6px; }

/* 批量 */
.match-card { margin-bottom: 14px; }
.match-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.match-head .code { font-weight: 700; color: var(--accent); }
.match-head .teams { font-weight: 600; }
.match-head .actual { margin-left: auto; display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.match-body { display: grid; grid-template-columns: 1fr 1fr; }
.match-body > div + div { border-left: 1px solid var(--line); }
.match-body h4 { margin: 0; padding: 8px 12px 4px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.mini td, .mini th { padding: 4px 6px; font-size: 12px; }
.mini td.actual-hit { outline: 2px solid var(--accent); outline-offset: -2px; }

.summary-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; align-items: center; }
.summary-chips b { font-size: 12px; color: var(--muted); font-weight: 600; margin-right: 2px; }

dialog {
  width: min(1280px, 96vw); max-height: 92vh; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; background: var(--panel); color: var(--text);
}
dialog::backdrop { background: rgba(10, 15, 25, .45); }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 8px; }
.dialog-head h2 { font-size: 17px; }
#quietDialog { width: min(600px, 96vw); }
.quiet-toggle { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 14px 0; }
.quiet-days { display: grid; gap: 10px; margin: 16px 0; }
.quiet-day { display: grid; grid-template-columns: 76px minmax(0, 1fr) 20px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.quiet-day label { display: flex; flex-direction: row; gap: 6px; align-items: center; white-space: nowrap; }
.quiet-day input[type="time"] { width: 100%; min-width: 0; }
.quiet-day:has(input[type="checkbox"]:disabled), .quiet-day:has(input[type="checkbox"]:not(:checked)) { opacity: .6; }
#quietSummary { margin: 0 0 12px; }
@media (max-width: 520px) {
  .quiet-day { grid-template-columns: 52px minmax(0, 1fr) 12px minmax(0, 1fr) 24px; gap: 4px; }
  .quiet-day input[type="time"] { padding: 8px 2px; font-size: 12px; }
}

.empty { padding: 40px; text-align: center; color: var(--muted); }

/* 低中高赔 */
.tier { display: inline-block; padding: 0 5px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; }
.tier.t0, .bar .t0, .stack .t0 { background: var(--tier0); }
.tier.t1, .bar .t1, .stack .t1 { background: var(--tier1); }
.tier.t2, .bar .t2, .stack .t2 { background: var(--tier2); }
.cchip em { font-style: normal; font-size: 10px; font-weight: 600; color: #fff; border-radius: 3px; padding: 0 3px; margin-left: 2px; }
.cchip em.t0 { background: var(--tier0); } .cchip em.t1 { background: var(--tier1); } .cchip em.t2 { background: var(--tier2); }
.dist-mode { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; }
.card-head:has(.dist-mode) { flex-wrap: wrap; }
.seg button, .market-tabs button { white-space: nowrap; }
td.miss { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
/* 匹配度 */
.lv { display: inline-block; min-width: 20px; padding: 0 4px; border-radius: 4px; font-size: 12px; font-weight: 600; text-align: center; }
.lv0 { background: var(--win-soft); color: var(--win); }
.lv1 { background: var(--draw-soft); color: var(--draw); }
.lv2 { background: var(--lose-soft); color: var(--lose); }
.lv-cell { white-space: nowrap; }
.lv-summary { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; margin: 10px 0; font-size: 13px; }
/* 单场回查表单提示 */
/* 生成图片 */
#imgDialog { width: min(1100px, 96vw); }
.img-form { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin: 6px 0 10px; }
.img-form label { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; }
.img-form input[type="number"] { width: 72px; }
.img-form .wide { flex-basis: 100%; }
.img-form .wide input { flex: 1; max-width: 520px; }
.img-cols { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.img-cols #imgCols { display: contents; }
.img-preview { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.img-preview:empty { display: none; }
.img-preview img { display: block; max-width: none; width: auto; height: auto; zoom: .5; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--muted); }
.about p, .about li { line-height: 1.75; }
.about code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 1100px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  #singleForm > .field-group:first-child, #singleForm .actions { grid-column: 1 / -1; grid-row: auto; }
  #singleForm .fg-spf-f { grid-column: 1; grid-row: 3; }
  #singleForm .fg-rq-f { grid-column: 2; grid-row: 3; }
  .result-grid, .match-body { grid-template-columns: 1fr; }
  .match-body > div + div { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .topbar { padding: 10px 16px; position: static; }
  .combo-table .cond { white-space: normal; min-width: 90px; }
  main { padding: 14px 16px 40px; }
  .form-grid, .batch-input { grid-template-columns: 1fr; }
  #singleForm .field-group, #singleForm .actions { grid-column: auto; grid-row: auto; }
  #singleForm .fg-gap { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .combo-table .bar-col { display: none; }
}

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters input { width: 150px; }
.opt { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.result-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.result-head h2 { font-size: 16px; margin-right: 6px; }
.note { font-size: 12px; color: var(--muted); margin: 10px 2px 0; }

.lock { max-width: 340px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; padding: 28px 24px; }
.logo-img { width: 36px; height: 36px; display: block; flex: none; }
.logo-img.lg { width: 56px; height: 56px; }
.lock input, .lock .btn { width: 100%; }
.lock-msg { min-height: 1.5em; color: var(--win); margin: 0; }

/* ---------- 首页 ---------- */
.home-hero { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 6px 0 14px; flex-wrap: wrap; }
.home-hero h2 { font-size: 26px; letter-spacing: .5px; }
.eyebrow { font-size: 11px; letter-spacing: 2px; color: var(--muted); margin-bottom: 4px; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.legend .b3 { background: var(--win); } .legend .b1 { background: var(--draw); } .legend .b0 { background: var(--lose); }

.metric-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.metric .k { font-size: 12px; color: var(--muted); }
.metric .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.metric .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.metric .s { font-size: 12px; color: var(--muted); }

.section-title { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; flex-wrap: wrap; }
.section-title h2 { font-size: 17px; }
.section-title .actions { margin-left: auto; }

.today-grid { display: grid; grid-template-columns: 380px 1fr; gap: 14px; margin-bottom: 26px; align-items: start; }
.fixture-date { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; padding: 10px 10px 0; }
.fixture-date input { width: 100%; }
.fx-note { margin: 8px 10px 0; padding: 6px 8px; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 6px; }
.conclusion .brief { color: var(--text); font-weight: 500; }
.conclusion .sub-h { margin-top: 6px; font-size: 12px; color: var(--muted); }
.today-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fixture-panel { position: sticky; top: 72px; }
.fixture-tools { display: grid; grid-template-columns: 1fr 120px; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.fixture-list { max-height: 640px; overflow-y: auto; padding: 6px; }
.fx {
  display: block; width: 100%; text-align: left; border: 1px solid transparent; background: none; color: var(--text);
  font: inherit; padding: 9px 10px; border-radius: 8px; cursor: pointer; margin-bottom: 2px;
}
.fx:hover { background: var(--bg); }
.fx.on { background: var(--accent-soft); border-color: var(--accent); }
.fx-meta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.fx-meta time { margin-left: auto; }
.fx-line { display: flex; align-items: baseline; gap: 10px; margin-top: 3px; }
.fx-teams { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-teams span { color: var(--muted); font-weight: 400; margin: 0 4px; font-size: 12px; }
.fx-odds { display: flex; gap: 8px; flex-shrink: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fx-odds b { color: var(--text); font-weight: 600; }

.match-top { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; flex-wrap: wrap; }
.match-top .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.match-top .title { font-size: 22px; font-weight: 700; margin-top: 4px; }
.match-top .title .vs { font-size: 13px; color: var(--muted); margin: 0 10px; font-weight: 500; }
.match-top .when { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.match-top .when small { display: block; color: var(--muted); font-size: 12px; }
.odds-summary { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.odds-col { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.odds-col + .odds-col { border-left: 1px solid var(--line); }
.odds-history details { border-top: 1px solid var(--line); }
.odds-history summary { cursor: pointer; padding: 10px 16px; font-weight: 600; font-size: 13px; color: var(--muted); }
.oh-grid { display: grid; grid-template-columns: 1fr 1fr; }
.oh-col { padding: 0 16px 12px; min-width: 0; }
.oh-col + .oh-col { border-left: 1px solid var(--line); }
.oh-col .odds-head { margin-bottom: 6px; }
.oh-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.oh-table th, .oh-table td { padding: 3px 6px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.oh-table th { color: var(--muted); font-weight: 500; }
.oh-table .left { text-align: left; }
.oh-col { max-height: 320px; overflow: auto; }
.oh-table i { font-style: normal; font-size: 10px; margin-left: 2px; }
.oh-table i.up { color: var(--win); }
.oh-table i.down { color: var(--lose); }
.oh-table sup { color: var(--muted); }
.oh-init { margin-left: 4px; padding: 0 4px; border-radius: 3px; font-size: 10px; background: var(--line); color: var(--muted); }
.odds-head { font-size: 13px; font-weight: 600; }
.odds-line { display: flex; align-items: center; gap: 14px; }
.odds-line .lbl { font-size: 12px; color: var(--muted); min-width: 32px; }
.odds-nums .up, .odds-nums .down { font-style: normal; font-size: 10px; margin-left: 2px; }
.odds-nums .up { color: var(--win); }
.odds-nums .down { color: var(--lose); }
.odds-nums .res-hit b { padding: 0 6px; border-radius: 6px; }
.odds-nums { display: flex; gap: 18px; }
.odds-nums div { text-align: center; }
.odds-nums span { display: block; font-size: 12px; color: var(--muted); }
.odds-nums b { font-size: 20px; font-variant-numeric: tabular-nums; }
.odds-nums .low b, .odds-nums .low span { color: var(--accent); }

.market-tabs { display: inline-flex; gap: 4px; }
.market-tabs button { border: 0; background: none; font: inherit; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.market-tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.options.inner { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; margin: 0; }
.table-x { overflow-x: auto; }
.home-table td { vertical-align: middle; }
.ckind { display: inline-block; font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 4px; padding: 0 6px; margin-right: 8px; }
.cchip { display: inline-flex; gap: 4px; align-items: baseline; border: 1px solid var(--line-strong); border-radius: 6px; padding: 1px 7px; font-variant-numeric: tabular-nums; font-weight: 600; }
.cchip i { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 400; }
.plus { color: var(--muted); margin: 0 4px; }
.dist { min-width: 240px; }
.dist .bar { height: 10px; gap: 2px; background: none; }
.dist .bar i { border-radius: 2px; }
.dist-v { display: flex; justify-content: space-between; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); margin-top: 3px; }
.dist-v .best { color: var(--text); }
.dist-v .actual-hit { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
.note.pad { padding: 0 14px 12px; }
.chev { color: var(--muted); font-size: 18px; }

.conclusion { padding: 10px 16px 14px; font-size: 13px; line-height: 1.8; max-height: 360px; overflow-y: auto; }
.conclusion h4 { margin: 8px 0 2px; font-size: 13px; }
.conclusion p { margin: 0; }
.conclusion .dimtxt { color: var(--muted); }
/* 首页统计简析卡片 */
.bf { padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.bf:last-child { border-bottom: 0; }
.bf-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.bf .k { flex: none; width: 60px; font-size: 12px; color: var(--muted); }
.bf .res { margin-right: 6px; font-weight: 500; font-size: 12px; }
.bf-lean { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-bottom: 6px; }
.bf-kpi { display: grid; grid-template-columns: 60px 1fr auto; align-items: center; gap: 2px 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.bf-kpi .c { font-weight: 600; font-variant-numeric: tabular-nums; }
.bf-kpi .n { color: var(--muted); font-size: 12px; text-align: right; }
.bf-kpi .mini-stack { grid-column: 2; min-width: 0; }
.bf-kpi > .res { grid-column: 3; justify-self: end; }
.bf-more { margin-top: 4px; font-size: 12px; color: var(--muted); }
.bf-more summary { cursor: pointer; }
.bf-more p { margin: 4px 0 0; }

.year-chart { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding: 26px 16px 10px; }
.yc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.yc i { display: block; width: 70%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.yc b { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.yc span { font-size: 11px; color: var(--muted); margin-top: 4px; }
.yc.zero b { color: var(--muted); font-weight: 400; }

/* 整体统计 */
.dash { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.dash .card { grid-column: span 3; }
.dash .card.w2 { grid-column: span 2; }
.dash .card.full { grid-column: 1 / -1; }
.card-body { padding: 12px 16px 16px; }
.card-head p { margin: 0; font-size: 12px; color: var(--muted); }
.stack { display: flex; height: 24px; gap: 2px; margin: 6px 0 4px; }
.stack i { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; color: #fff; font-weight: 600; min-width: 2px; }
.stack i:first-child { border-radius: 4px 0 0 4px; }
.stack i:last-child { border-radius: 0 4px 4px 0; }
.b3 { background: var(--win); }
.b1 { background: var(--draw); }
.b0 { background: var(--lose); }
.stack-row { margin-bottom: 14px; }
.stack-row .lab { display: flex; justify-content: space-between; font-size: 13px; }
.stack-row .lab span { color: var(--muted); font-size: 12px; }
.mini-stack { display: flex; height: 8px; gap: 2px; min-width: 120px; }
.mini-stack i { display: block; }
.mini-stack i:first-child { border-radius: 3px 0 0 3px; }
.mini-stack i:last-child { border-radius: 0 3px 3px 0; }
.trip { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }

.ycol-chart { display: flex; align-items: flex-end; gap: 6px; height: 230px; padding: 30px 16px 12px; }
.ycol { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
.ycol .col { width: 70%; max-width: 34px; display: flex; flex-direction: column; gap: 2px; }
.ycol .col i { display: block; }
.ycol .col i:first-child { border-radius: 4px 4px 0 0; }
.ycol b { font-size: 11px; font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.ycol span { font-size: 11px; color: var(--muted); margin-top: 4px; }

.hbars .row { display: grid; grid-template-columns: 52px 1fr 64px; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.hbars .row .track { height: 12px; }
.hbars .row .track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbars .row em { font-style: normal; color: var(--muted); text-align: right; }
/* 单关 */
.tag-single { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 4px; font-size: 11px; line-height: 16px; color: var(--accent); background: var(--accent-soft); vertical-align: 1px; }
.sg-seq { border-top: 1px solid var(--line); }
.sg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; font-size: 13px; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; }
.dots .dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-style: normal; cursor: default; }
/* 本场实际赛果所在行 */
.hbars .row.hit span, .hbars .row.hit em { color: var(--text); font-weight: 600; }
.hbars .row.hit { background: var(--hit); border-radius: 4px; }
.hbars .row.hit .track i { background: var(--draw); }
#playStats .note .btn { margin-left: 8px; }

.calib .track { position: relative; height: 12px; background: var(--bg); border-radius: 4px; min-width: 120px; }
.calib .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 4px; }
.calib .track u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.diff.up { color: var(--lose); }
.diff.down { color: var(--win); }
.compact td, .compact th { padding: 5px 8px; font-size: 12px; }

#tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: var(--panel);
  font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: pre; display: none; font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .today-grid { grid-template-columns: 1fr; }
  .fixture-panel { position: static; }
  .fixture-list { max-height: 260px; }
  .dash .card, .dash .card.w2 { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .odds-summary { grid-template-columns: 1fr; }
  .oh-grid { grid-template-columns: 1fr; }
  .oh-col + .oh-col { border-left: 0; border-top: 1px solid var(--line); padding-top: 10px; }
  .odds-col + .odds-col { border-left: 0; border-top: 1px solid var(--line); }
  .section-title .actions { margin-left: 0; }
  .seg button { padding: 5px 8px; }
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
.sort-ico { margin-left: 3px; color: var(--accent); }

.and { display: inline-block; margin: 0 6px; font-size: 12px; font-weight: 600; color: var(--accent); }

/* 单场 / 批量：全部条件“且”的单一结果 */
.cond-line { margin: 2px 0 0; font-size: 13px; color: var(--muted); white-space: normal; }
.big-n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.big-n small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.dist-block .lab { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.dist-block .lab span { color: var(--muted); font-size: 12px; font-weight: 400; }
.batch-table th.grp, .batch-table td.grp { border-left: 1px solid var(--line-strong); }
.batch-table td.cond { white-space: normal; min-width: 220px; font-size: 12px; }
.use-boxes { display: flex; gap: 10px; flex-wrap: wrap; }


/* 登录与后台 */
.login-page main { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-page .lock { width: min(360px, 100%); margin: 0; }
.field { width: 100%; text-align: left; }
.field input { width: 100%; }
.userbox { display: flex; align-items: center; gap: 6px; }
.inline-pair { display: flex; gap: 6px; }
.inline-pair input { width: 80px; }
.btn.danger { color: var(--win); }
.users-table td { white-space: nowrap; }
.users-table select { padding: 2px 6px; }
td.wrap { white-space: normal; min-width: 160px; max-width: 320px; font-size: 12px; color: var(--muted); }
.st-ok { color: var(--lose); font-weight: 600; }
.st-partial, .st-interrupted { color: var(--draw); font-weight: 600; }
.st-failed { color: var(--win); font-weight: 600; }
.st-running { color: var(--accent); font-weight: 600; }
.sched-note { flex-basis: 100%; margin: 0; }
.pw-form { display: flex; flex-direction: column; gap: 10px; min-width: min(340px, 80vw); }
#pwDialog { width: auto; }

.paste-box { margin-top: 12px; }
.paste-box summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.paste-box textarea { margin: 6px 0; }
.opt-title { font-size: 12px; font-weight: 600; color: var(--text); align-self: center; }

/* 单场回查：筛选区放顶部（默认）或右侧 */
.view-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 10px; }
.single-wrap.side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.single-wrap.side .single-controls { order: 2; position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; }
.single-wrap.side #singleResult { order: 1; min-width: 0; }
.single-wrap.side .form-grid { grid-template-columns: 1fr; gap: 14px; }
.single-wrap.side .field-group { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.single-wrap.side .field-group label { grid-row: auto; }
.single-wrap.side #singleForm .field-group, .single-wrap.side #singleForm .actions { grid-column: auto; grid-row: auto; }
.single-wrap.side #singleForm .fg-gap { display: none; }
.single-wrap.side .result-grid { grid-template-columns: 1fr; }
.hc-fixed input { width: 80px; }
@media (max-width: 1100px) {
  .view-toolbar { display: none; }
  .single-wrap.side { display: block; }
  .single-wrap.side .single-controls { position: static; max-height: none; }
}

/* 首页比赛详情：支持率 */
.support { margin-top: 2px; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; }
.support .sup-bar { flex: 1; height: 18px; margin: 0; }
.support .sup-bar i { font-size: 11px; }
.sup-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.hot { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; font-weight: 600; }
.hot.up { background: var(--win-soft); color: var(--win); }
.hot.down { background: var(--lose-soft); color: var(--lose); }

/* 概念说明：“?” 图标与弹出卡片 */
.tip {
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 4px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--panel); color: var(--muted);
  font-family: inherit; font-size: 10px; font-weight: 600; line-height: 1; cursor: help; vertical-align: middle; flex: none;
}
.tip:hover, .tip:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
#termPop {
  position: absolute; z-index: 60; max-width: min(320px, calc(100vw - 16px)); padding: 10px 12px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(10, 15, 25, .18); font-size: 13px; line-height: 1.6; text-align: left; white-space: normal;
}
#termPop b { display: block; margin-bottom: 2px; }
#termPop p { margin: 0; color: var(--muted); }
.color-mode { display: inline-flex; align-items: center; gap: 6px; }

/* 免责声明 */
.site-foot { max-width: 1320px; margin: 0 auto; padding: 16px 24px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.site-foot p { margin: 0; }
.login-page main { align-content: center; }
.login-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
@media (max-width: 720px) { .site-foot { padding: 14px 16px 24px; } }

/* 记录浮窗全屏 */
#recordDialog.full { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; border: 0; }
