/* Hallmark · macrostructure: Stat-Led + Catalogue · tone: technical-austere
 * theme: studied-DNA (source: https://gg257.bet/cn/league-of-legends)
 * paper #151517 · accent #FF4800 橙红(锚点) · odds #00FF85 荧光绿(赔率) · display: heavy system sans · data: ui-monospace
 * studied: yes · DNA-source: url
 * pre-emit critique: P4 H5 E5 S4 R5 V4
 * 回测工作台（/backtest.html）：仪表化页眉 → stat-led 战绩台账 → 引擎控制面 → stat-led 运行结果 → catalogue 历史台账。
 * 层级用三级面（页面/卡片/内嵌）表达纵深，不依赖阴影与渐变；数字一律 tabular-nums + mono 数据声部。 */

:root {
  /* 设计 token（沿用看板 DNA：橙红锚点 + 荧光绿数据，语义色仅限盈亏/错误；三级面表达纵深）。
   * L4：与 public/css/style.css 共用同一套 token 名与 DNA；本页"页面底/卡片"面值刻意更深一档
   * （仪器纵深），其余 token（--muted/--dim/--accent/--green 等）数值一致。 */
  --bg: #151517;          /* 页面底：比看板再深半档，突出工作台纵深 */
  --surface-1: #1d1d20;   /* 卡片面 */
  --surface-2: #26262a;   /* 内嵌面：输入/统计格/表行 hover */
  --surface-3: #2e2e33;   /* 更浅面：hover 高亮 */
  --line: #2c2c31;        /* 发丝分隔 */
  --line-strong: #3b3b3c; /* 卡片边框/强分隔 */
  --text: #f2f2f2;
  --muted: #9d9d9d;
  --dim: #6e6e76;         /* 弱化文字 */
  --dim-2: #56565e;       /* 更弱化文字：台账开赛时间/待结算等次级小字 */
  --accent: #ff4800;      /* 锚点色：主操作/焦点环/激活 */
  --accent-strong: #d13c00; /* 按钮底色（白字 4.82:1） */
  --on-accent: #ffffff;
  --green: #00ff85;       /* 唯一强调色：数据（命中/ROI/盈亏） */
  --red: #f85149;         /* 语义色：亏损/错误 */

  /* 兼容别名（JS 内联样式与历史类引用） */
  --card: var(--surface-1);
  --card2: var(--surface-3);
  --bg2: var(--surface-2);
  --border: var(--line-strong);

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  /* motion token（Hallmark 三曲线） */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --dur-micro: 120ms;
  --dur-short: 220ms;
  --dur-long: 420ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 16px 60px; }

/* ============ 仪表化页眉（masthead） ============ */
.mast { padding: 4px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.mast-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.mast-id {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.mast-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); flex: none; }
.mast-status {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; /* L1：长状态文案窄屏省略，不撑破 */
}
.mast-status b { color: var(--text); font-weight: 600; }
.mast-status .error { color: var(--red); }
.back-link {
  margin-left: auto; color: var(--muted); font-size: 13px; text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 12px;
  transition: border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
  white-space: nowrap;
}
.back-link:hover { border-color: var(--accent); color: var(--accent); }
/* 双栏 masthead：左=标题+简述+引导，右=指标口径参考面板（填满右侧留白而非空置） */
.mast-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; margin-top: 14px; align-items: start; }
.mast-lead { min-width: 0; }
.mast-title {
  font-size: clamp(22px, 2.6vw + 12px, 28px); font-weight: 800;
  letter-spacing: -0.01em; line-height: 1.15; overflow-wrap: anywhere;
}
.mast-sub { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.6; }

.hint { color: var(--muted); font-size: 12px; margin-top: 10px; line-height: 1.7; }

/* 指标口径面板（可折叠）：默认收起，点击标题展开；标题行即面板头 */
.mast-metrics {
  background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 14px;
  overflow: hidden;
}
.mm-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 12px 16px; font-family: var(--font-body); font-size: 12px; text-align: left;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.mm-toggle:hover { background: var(--surface-2); color: var(--text); }
.mm-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; font-weight: 600; color: var(--muted); }
.mm-toggle:hover .mm-title { color: var(--text); }
.mm-caret { font-size: 10px; color: var(--accent); transition: transform var(--dur-short) var(--ease-out); }
.mast-metrics.open .mm-caret { transform: rotate(90deg); }
.mm-body { padding: 0 16px 6px; }
.mast-metrics:not(.open) .mm-body { display: none; }
.mm-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; font-size: 12px; border-top: 1px solid var(--line); }
.mm-row:first-of-type { border-top: none; }
.mm-k { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--accent); width: 78px; flex: none; }
.mm-v { color: var(--muted); line-height: 1.6; }

/* ============ 分组头 ============ */
.group { margin-bottom: 26px; }
.group-title {
  font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0.5px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.group-title::before { content: ""; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; flex: none; }
.gr-meta { font-weight: 400; color: var(--dim); font-size: 12px; letter-spacing: 0; }

/* ============ 统计格（Stat-Led 主结构） ============ */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
  margin-bottom: 14px;
}
.stat-cell {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; min-width: 0;
}
.stat-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
  color: var(--muted); font-weight: 600; margin-bottom: 6px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.stat-value {
  font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere;
}
.stat-value.tone-green { color: var(--green); }
.stat-value.tone-red { color: var(--red); }
.stat-sub { font-size: 11px; color: var(--dim); margin-top: 5px; }

/* ============ 引擎控制面 ============ */
.engines { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.engine-card {
  background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color var(--dur-short) var(--ease-out);
}
.engine-card:hover { border-color: var(--card2); }
.engine-card.running { opacity: 0.65; pointer-events: none; }
.e-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.e-title { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.e-badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; white-space: nowrap; flex: none;
}
.e-desc { font-size: 12px; color: var(--muted); line-height: 1.65; }
.e-params { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.p-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.p-row label {
  color: var(--muted); width: 112px; flex-shrink: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.p-row input {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 12px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; outline: none;
  transition: border-color var(--dur-short) var(--ease-out);
}
.p-row input:hover { border-color: var(--line-strong); }
.p-row input:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.p-hint { font-size: 11px; color: var(--dim); margin-top: -4px; padding-left: 120px; }
.e-run { margin-top: auto; align-self: flex-start; }

/* ============ 按钮（8 态） ============ */
button {
  background: var(--accent-strong); color: var(--on-accent); border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: var(--font-body);
  transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
  white-space: nowrap;
}
button:hover { background: var(--accent); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:not(:disabled):active { transform: translateY(1px); }
button.ghost {
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong);
}
button.ghost:hover { background: var(--surface-3); color: var(--text); }
/* loading：左侧环形 spinner（与看板一致；只在真实异步期间出现，>150ms 才可见） */
button.loading { position: relative; padding-left: 34px; }
button.loading::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 12px; height: 12px;
  margin-top: -6px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: var(--on-accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
button.ghost.loading::before { border-color: rgba(255, 255, 255, 0.2); border-top-color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
/* focus-visible：即时出现，不动画 */
button:focus-visible,
.hist-row:focus-visible,
.back-link:focus-visible,
.tab.mini:focus-visible,
.c-head:focus-visible,
.ledger-day:focus-visible,
.bet-row:focus-visible,
.del-run:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ============ 结果区 ============ */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.chart-box { background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px 16px; }
.chart-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.chart-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chart-dot.acc { background: var(--accent); }
.chart-dot.ll { background: var(--green); }
.chart-box canvas { max-width: 100%; }
.note-box {
  background: rgba(255, 72, 0, 0.05); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 12px; color: var(--muted); line-height: 1.7; margin-bottom: 14px;
}
.note-box b { color: var(--text); }
.diag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.diag-box {
  background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 12px 14px; font-size: 12px; color: var(--muted); line-height: 1.8;
}
.diag-box b { color: var(--text); }
.diag-box .mono { font-family: var(--font-mono); font-size: 11px; color: var(--green); font-variant-numeric: tabular-nums; }

/* 结果浮现（run 完成后一次性 reveal；reduced-motion 降级） */
#resultGroup.reveal .stat-grid,
#resultGroup.reveal .charts {
  animation: rise var(--dur-long) var(--ease-out) both;
}
#resultGroup.reveal .charts { animation-delay: 70ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ============ 历史区（Catalogue） ============ */
#history { overflow-x: auto; }
.hist-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 720px; }
.hist-table th, .hist-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.hist-table th {
  color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.5px;
  border-bottom-color: var(--line-strong); white-space: nowrap;
}
.hist-table tr { cursor: pointer; }
.hist-table tr:hover td { background: var(--surface-2); }
.hist-table td.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; }
.hist-table .acc-good { color: var(--green); font-weight: 700; }
.hist-table .acc-bad { color: var(--red); font-weight: 700; }
.hist-table .del-run { padding: 3px 10px; font-size: 11px; font-weight: 600; }
.hist-empty { color: var(--muted); font-size: 12px; padding: 12px 0; }

#runDetail { margin-top: 14px; }
.loading { color: var(--muted); font-size: 13px; padding: 20px 0; }
.error { color: var(--red); font-size: 13px; padding: 10px 0; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; font-size: 13px; }

/* ============ ROI 战绩台账 ============ */
#roiPanel .match-card {
  background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 14px 16px;
}
.filt-tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.tab.mini {
  padding: 4px 12px; font-size: 12px; border-radius: 999px; cursor: pointer; user-select: none;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
  white-space: nowrap;
}
.tab.mini:hover { border-color: var(--line-strong); color: var(--text); }
.tab.mini.active { background: var(--accent-strong); color: var(--on-accent); border-color: var(--accent-strong); }
.filt-sep { color: var(--dim); font-size: 12px; margin: 0 2px; user-select: none; }
/* 多维筛选控件（联赛/阶段/盘口/状态下拉 + 自定义日期区间）：与 pill 同一令牌声部——
 * 深内嵌面 + 发丝边框；focus-visible 锚点橙（全站一致）；日期控件 color-scheme: dark 走原生深色弹层 */
.f-sel { display: inline-flex; align-items: center; gap: 5px; }
.f-lab { font-size: 11px; color: var(--dim); white-space: nowrap; }
.f-select, .f-date {
  background-color: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 3px 8px; font-size: 12px; font-family: var(--font-body);
  max-width: 170px; color-scheme: dark;
  transition: border-color var(--dur-short) var(--ease-out);
}
.f-select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) calc(50% + 1px), calc(100% - 8px) calc(50% + 1px);
  background-size: 4px 4px; background-repeat: no-repeat;
}
.f-select:hover, .f-date:hover { border-color: var(--dim); }
.f-select:focus-visible, .f-date:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.f-dash { color: var(--dim); font-size: 12px; }
/* 筛选状态徽标 + 一键清除（仅在确有筛选时出现，默认"全部数据"不占位） */
.f-on {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; border-radius: 999px;
  padding: 2px 10px; white-space: nowrap; color: var(--accent);
  background: rgba(255, 72, 0, 0.1); border: 1px solid rgba(255, 72, 0, 0.45);
}
.f-clear { padding: 3px 12px; font-size: 11px; font-weight: 600; border-radius: 999px; }
#roiPanel .l-sum { font-size: 12px; color: var(--muted); margin-top: 10px; }
#roiPanel .l-sum b { font-weight: 700; color: var(--text); }
#roiPanel .l-scroll { overflow-x: auto; margin-top: 8px; }
#roiPanel table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
#roiPanel th, #roiPanel td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
#roiPanel th { color: var(--muted); font-weight: 500; font-size: 11px; border-bottom-color: var(--line-strong); }
#roiPanel th.num { text-align: right; }
/* 明细行层级（2026-08 重点化：买谁→锚点橙加粗 / 赔率→荧光绿 mono / 盈亏→语义色加粗，
 * 时间·盘口·标签→弱化小字；日期行→光标+日期加粗，注数/命中/下注额→次级 mono） */
#roiPanel td.l-time { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--font-mono); width: 90px; }
#roiPanel td.l-time.dim { color: var(--dim-2); font-size: 10px; width: 90px; }
#roiPanel td.l-sub { font-size: 11px; color: var(--muted); }
#roiPanel td.m-match { font-weight: 600; color: var(--text); }
#roiPanel td.m-market { color: var(--dim); font-size: 11px; }
#roiPanel td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; width: 62px; }
#roiPanel .res-win { color: var(--green); font-weight: 700; }
#roiPanel .res-lose { color: var(--red); font-weight: 700; }
#roiPanel .res-pending { color: var(--dim); font-size: 11px; }
#roiPanel .pnl-win { color: var(--green); font-weight: 700; }
#roiPanel .pnl-lose { color: var(--red); font-weight: 700; }
#roiPanel td.num.pnl-win, #roiPanel td.num.pnl-lose { font-weight: 800; }
#roiPanel td.pick-txt { text-align: left; }
#roiPanel .pick-name { color: var(--accent); font-weight: 800; display: inline-block; min-width: 36px; }
#roiPanel .pick-badge { display: inline-block; min-width: 15px; margin-left: 0; font-size: 11px; color: var(--accent); font-weight: 700; text-align: center; }
#roiPanel td.odds-txt { color: var(--green); font-weight: 700; width: 60px; }
#roiPanel td.state-txt { width: 56px; }
#roiPanel .v-tag { color: var(--accent); font-weight: 700; font-size: 11px; }
#roiPanel .ledger-day:hover { background: var(--surface-2); }
#roiPanel td.l-date { font-weight: 700; color: var(--text); white-space: nowrap; }
#roiPanel .l-caret { color: var(--accent); font-size: 10px; display: inline-block; margin-right: 6px; transition: transform var(--dur-short) var(--ease-out); }
#roiPanel .ledger-day.open .l-caret { transform: rotate(90deg); }

/* 赛前 / 赛中 下注区分徽标（pre=赛前预测 / live=赛中实时，live 用锚点橙强调动态） */
.phase-tag {
  font-size: 10px; font-weight: 700; border-radius: 9px; padding: 1px 7px;
  letter-spacing: 0.3px; white-space: nowrap; margin-left: 4px;
}
.phase-tag.pre { background: rgba(255, 255, 255, 0.06); color: var(--muted); border: 1px solid var(--line-strong); }
.phase-tag.live { background: rgba(255, 72, 0, 0.14); color: var(--accent); border: 1px solid rgba(255, 72, 0, 0.45); }

/* ---- 未下注（未过门/评估中）：与下注行强区分——整体弱化、日期行角标、专属状态徽标 ----
 * 语义：系统评估过但没下注 ≠ 遗漏；已结束=终局"未过门"，未开赛/赛中=流动"评估中" */
#roiPanel .nb-chip {
  display: inline-block; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 1px 7px;
  margin-left: 6px; letter-spacing: 0.3px; white-space: nowrap; vertical-align: 1px;
  color: var(--muted); background: rgba(255, 255, 255, 0.04); border: 1px dashed var(--line-strong);
}
#roiPanel tr.nb-row td { color: var(--dim); background: repeating-linear-gradient(135deg, transparent 0 9px, rgba(255, 255, 255, 0.014) 9px 18px); }
#roiPanel tr.nb-row td.m-match { color: var(--muted); font-weight: 500; }
#roiPanel tr.nb-row:hover td, #roiPanel tr.nb-row:focus td { background: var(--surface-2); }
#roiPanel .nb-state {
  display: inline-block; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 1px 7px;
  letter-spacing: 0.3px; white-space: nowrap;
}
#roiPanel .nb-state.final { color: var(--dim); border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); }
#roiPanel .nb-state.eval { color: #d8b34a; border: 1px solid rgba(216, 179, 74, 0.4); background: rgba(216, 179, 74, 0.1); }
#roiPanel td.nb-reason { color: var(--dim); font-size: 12px; white-space: normal; min-width: 220px; }
#roiPanel .nb-head {
  margin-top: 12px; margin-bottom: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--dim); border-left: 3px solid var(--line-strong); padding-left: 8px;
}
#roiPanel table.nb-table { min-width: 0; font-size: 12px; }

/* ---- 「今天」比赛日重点展示：左侧锚点橙条 + 淡橙底贯穿 + 实底"今天"徽标 ----
 * 今天 = 进行时（注待结算/场次评估中），且日期倒序时常被未来比赛日（排序在其上）压住——
 * 提出来：日期行与展开区同色贯穿（3px 左橙条 + 淡橙底），逐条视图当日行同款高亮（置于 nb-row
 * 之后声明，今天优先于未下注弱化纹理）；徽标呼吸光晕提醒（reduced-motion 由全局收敛块关闭） */
#roiPanel tr.ledger-day.is-today td { background: rgba(255, 72, 0, 0.07); }
#roiPanel tr.ledger-day.is-today td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
#roiPanel tr.ledger-day.is-today:hover td { background: var(--surface-2); }
#roiPanel tr.ledger-detail.is-today > td {
  background: rgba(255, 72, 0, 0.03);
  box-shadow: inset 3px 0 0 var(--accent);
}
#roiPanel tr.is-today-row td { background: rgba(255, 72, 0, 0.05); }
#roiPanel tr.is-today-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
#roiPanel .today-chip {
  display: inline-block; font-size: 10px; font-weight: 800; border-radius: 9px; padding: 1px 8px;
  margin-left: 7px; letter-spacing: 1px; vertical-align: 1px; white-space: nowrap;
  color: var(--on-accent); background: var(--accent-strong);
  animation: todayPulse 2.6s var(--ease-out) infinite;
}
@keyframes todayPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 72, 0, 0.45); }
  60% { box-shadow: 0 0 0 5px rgba(255, 72, 0, 0); }
}

/* 下注理由悬浮提示（悬浮查看，与推送择时建议一致；focus 也可达，非 hover-only）。
 * 2026-08 放大：宽度 560px、正文 13.5px、更宽松内边距与行距；超长理由限高滚动 */
#betTip {
  position: fixed; z-index: 60;
  max-width: min(560px, calc(100vw - 16px)); /* M3：窄屏按视口收缩，避免超出右缘 */
  width: max-content;
  background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 14px 16px; font-size: 13.5px; color: var(--muted); line-height: 1.7;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-short) var(--ease-out);
  max-height: 60vh; overflow-y: auto;
}
#betTip.show { opacity: 1; }
#betTip .tt-title { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0.3px; margin-bottom: 7px; font-variant-numeric: tabular-nums; }
#betTip .tt-timing { color: var(--accent); font-weight: 600; }
#betTip .tt-line { color: var(--muted); }
#betTip .tt-label { color: var(--dim); font-weight: 700; margin-top: 8px; }
#betTip .tt-reason { color: var(--muted); }

/* 折叠面板 */
.c-head { cursor: pointer; user-select: none; }
.c-head .c-caret { display: inline-block; transition: transform var(--dur-short) var(--ease-out); font-size: 10px; color: var(--accent); }
.c-open .c-caret { transform: rotate(90deg); }
.c-head .c-brief { color: var(--muted); font-weight: 400; font-size: 12px; }
.c-body { display: none; }
.c-open .c-body { display: block; }

/* ============ 页脚 colophon ============ */
.colophon {
  margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.5px; color: var(--dim);
}

/* ============ 赔率走势弹窗（台账行"走势"按钮） ============
 * 结构与看板 modal 一致；配色走本页 token（surface-1 面板 / line-strong 边框 / accent 关闭悬停） */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
  display: none; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 14px;
  max-width: 720px; width: 100%; max-height: 80vh; overflow: auto; padding: 20px;
}
.modal h3 { font-size: 15px; margin-bottom: 4px; }
.modal .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.modal table { width: 100%; border-collapse: collapse; font-size: 13px; }
.modal th, .modal td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.modal th { color: var(--muted); font-weight: 500; font-size: 12px; }
.modal .close { float: right; background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 2px 6px; }
.modal .close:hover { background: none; color: var(--text); }
.modal .delta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.modal .delta.up { color: var(--green); }
.modal .delta.down { color: var(--red); }
.modal .empty { padding: 18px 0; }

/* 台账行内"走势"小按钮：ghost 深内嵌面（不抢买谁/赔率的视觉层级），行 hover 时微亮 */
#roiPanel button.hist {
  padding: 1px 9px; font-size: 10.5px; font-weight: 700; margin-left: 6px; vertical-align: 1px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong);
  border-radius: 999px; white-space: nowrap;
}
#roiPanel button.hist:hover { background: var(--surface-3); color: var(--accent); border-color: var(--accent); }
#roiPanel button.hist:active { transform: translateY(1px); }
#roiPanel button.hist:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 决策面板（走势弹窗顶部）：为什么下 / 为什么没下 —— 四门检核 + 择时批次 + no_bet 裁决 */
.modal .dec-panel {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.75;
}
.modal .dec-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 7px; }
.modal .dec-gates { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.modal .gate {
  display: inline-flex; align-items: baseline; gap: 5px; border-radius: 8px; padding: 3px 9px;
  font-size: 11.5px; border: 1px solid var(--line-strong); background: var(--surface-1); color: var(--muted);
}
.modal .gate b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.modal .gate i { font-style: normal; font-size: 10px; color: var(--dim); }
.modal .gate.pass { border-color: rgba(0, 255, 133, 0.4); background: rgba(0, 255, 133, 0.07); }
.modal .gate.fail { border-color: rgba(248, 81, 73, 0.5); background: rgba(248, 81, 73, 0.08); }
.modal .gate.fail b { color: var(--red); }
.modal .gate.na { opacity: 0.65; }
.modal .dec-line { color: var(--muted); }
.modal .dec-line b { color: var(--text); }
.modal .dec-sub { font-size: 11px; font-weight: 700; color: var(--dim); margin-top: 7px; letter-spacing: 0.4px; }
.modal .dec-tranche {
  font-variant-numeric: tabular-nums; color: var(--muted);
  border-left: 2px solid var(--accent); padding-left: 8px; margin-top: 3px;
}
/* 下注条件（未下注裁决 conds）：逐方向列出未满足条件；触发赔率与概率条件都在 need 里 */
.modal .dec-cond {
  font-variant-numeric: tabular-nums; color: var(--muted);
  border-left: 2px solid var(--dim); padding-left: 8px; margin-top: 3px;
}
.modal .dec-cond b { color: var(--text); }
/* 条件的白话行（💬）：比条件本体小一号、弱一档，视觉上从属于上一行的"→ 条件" */
.modal .dec-cond .plain-line { display: block; font-size: 11px; color: var(--dim); margin-top: 1px; line-height: 1.6; }
/* 白话拆解块（未下注裁决通俗化，2026-09-12）：蓝色边线与条件区（灰）区分——这是"解读"不是"条件" */
.modal .dec-plain {
  font-variant-numeric: tabular-nums; color: var(--muted); line-height: 1.7;
  border-left: 2px solid rgba(79, 140, 255, 0.45); padding-left: 8px; margin-top: 3px;
}
.modal .dec-plain b { color: var(--text); }
/* 通用问答折叠（EV 是什么 / 为什么大多数比赛不下注）：虚线框弱化存在感，点开才占高度 */
.modal .dec-faq { margin-top: 8px; border: 1px dashed var(--line-strong); border-radius: 8px; padding: 5px 10px 6px; }
.modal .dec-faq summary {
  font-size: 11px; font-weight: 700; color: var(--dim); cursor: pointer; list-style: none; user-select: none;
}
.modal .dec-faq summary::-webkit-details-marker { display: none; }
.modal .dec-faq summary::before { content: '▸'; margin-right: 5px; }
.modal .dec-faq[open] summary::before { content: '▾'; }
.modal .dec-faq[open] summary { margin-bottom: 2px; }
.modal .dec-faq .faq-item { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-top: 4px; }
.modal .dec-faq .faq-item b { color: var(--text); }
.modal .dec-verdict { margin-bottom: 6px; }
.modal .dec-note { font-size: 10.5px; color: var(--dim); margin-top: 7px; }
/* 开盘校准期徽标：琥珀色（与 nb-state.eval 同族），提示该注下于庄家找平衡的抖动阶段 */
.modal .disc-tag {
  display: inline-block; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 7px;
  color: #d8b34a; border: 1px solid rgba(216, 179, 74, 0.4); background: rgba(216, 179, 74, 0.1);
  vertical-align: 1px; white-space: nowrap;
}

/* ============ 响应式（Gate 34：320/375/414/768 无横向滚动；表格用内滚容器） ============ */
@media (max-width: 768px) {
  .charts { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-height: 86vh; padding: 14px; }
}
@media (max-width: 640px) {
  .wrap { padding: 20px 12px 48px; }
  .mast-top { gap: 8px; }
  .back-link { margin-left: 0; }
  .mast-grid { grid-template-columns: 1fr; gap: 14px; }
  .engines { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-cell { padding: 10px 12px; }
  .stat-value { font-size: 22px; }
  .p-hint { padding-left: 0; }
}
@media (max-width: 380px) {
  .mast-title { font-size: 21px; }
  .stat-grid { grid-template-columns: 1fr; }
  .mast-id { letter-spacing: 1px; }
}

/* ============ 无障碍：减少动态效果 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  #resultGroup.reveal .stat-grid,
  #resultGroup.reveal .charts { animation: none; }
}
