/* ── LIGHT theme (default) ── */
:root {
  /* Core surfaces */
  --bg:          #f5f7fa;
  --surface:     #ffffff;
  --surface-2:   #f0f3f8;
  --surface-3:   #e6ebf2;

  /* Text — `--dim` raised so 4.5:1 holds even on white; reserve --dim for
     truly tertiary text (timestamps, small foot meta). */
  --ink:         #1a2332;
  --muted:       #5a6478;
  --dim:         #6c7888;

  /* Borders */
  --grid:        #c8d1de;
  --grid-soft:   #dde3ec;

  /* Striping for tables (zebra rows) */
  --row-alt:     #f6f8fc;

  /* Accents — red toned down per UI rules; alpha utility values mirror it. */
  --accent:      #c0392b;
  --accent-soft: rgba(192, 57, 43, 0.10);
  --blue:        #0d6efd;
  --blue-soft:   rgba(13, 110, 253, 0.08);
  --green:       #1f9d55;
  --green-soft:  rgba(31, 157, 85, 0.10);
  --amber:       #c47f00;
  --amber-soft:  rgba(196, 127, 0, 0.10);
  --purple:      #7c3aed;
  --purple-soft: rgba(124, 58, 237, 0.10);

  /* Semantic */
  --hit:    #c0392b;
  --sum:    #0d6efd;
  --shadow: none;

  /* Type stacks — body uses sans, headlines/labels lean on a slightly
     stylish stack but stays within common UI fonts. Mono for digit columns. */
  --font-body:    "Fira Sans", "Inter", "Helvetica Neue", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-display: "Source Sans 3", "Fira Sans", "Inter", "Helvetica Neue", system-ui, sans-serif;
  --font-mono:    "Fira Code", "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}

/* ── DARK theme (opt-in via body.dark) ── */
body.dark {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #1c2333;
  --surface-3:   #21262d;

  --ink:         #e6edf3;
  --muted:       #8b949e;
  --dim:         #6b7480;

  --grid:        #30363d;
  --grid-soft:   #21262d;

  --row-alt:     #0f1520;

  --accent:      #ff5757;
  --accent-soft: rgba(255, 87, 87, 0.14);
  --blue:        #58a6ff;
  --blue-soft:   rgba(88, 166, 255, 0.12);
  --green:       #4ade80;
  --green-soft:  rgba(74, 222, 128, 0.14);
  --amber:       #fbbf24;
  --amber-soft:  rgba(251, 191, 36, 0.12);
  --purple:      #c084fc;
  --purple-soft: rgba(192, 132, 252, 0.12);

  --hit:    #ff5757;
  --sum:    #58a6ff;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

select, button { font: inherit; cursor: pointer; }

.page-shell {
  width: min(1760px, calc(100vw - 10px));
  margin: 6px auto 14px;
}

/* ── Cards ── flat panels separated by spacing + a single hairline; no elevation. */
.hero,
.controls,
.table-card,
.stats-card {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 12px;
}

/* ── Hero ── */
.hero {
  padding: 10px 14px 8px;
}

.eyebrow {
  margin: 0 0 3px;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  color: var(--accent);
  font-size: 12px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1;
  font-weight: 600;
  color: var(--ink);
}

/* ── Controls ── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 12px;
  align-items: end;
}

.controls label { display: grid; gap: 3px; }

.stats-label,
.controls span {
  font-size: 12px;
  color: var(--muted);
}

.controls select,
.controls button {
  min-height: 30px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 0 10px;
  /* select 的三角是浏览器画在内容盒右侧的，padding 只有 10px 时会压在
     「七星彩」这种三字彩种名上。下面单独给 select 留出箭头的位置。 */
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12px;
  transition: border-color 150ms;
}

/* 原生 select 的下拉箭头要额外留位，否则文字会被箭头压住 */
.controls select { padding-right: 26px; }

.controls select:focus {
  outline: none;
  border-color: var(--blue);
}

.controls button {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  padding: 0 20px;
  transition: opacity 150ms;
}

.controls button:hover { opacity: 0.82; }
.controls button:disabled { opacity: 0.5; cursor: wait; }

.controls button.secondary-btn {
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--grid);
}

.controls button.secondary-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  opacity: 1;
}

/* 同步按钮: 用蓝色与"刷新数据"(红/accent) 视觉区分，强调"拉取新数据"的语义 */
.controls button.sync-btn {
  background: rgba(88, 166, 255, 0.12);
  color: rgb(88, 166, 255);
  border: 1px solid rgba(88, 166, 255, 0.45);
  font-weight: 500;
  padding: 0 14px;
}
.controls button.sync-btn:hover {
  background: rgba(88, 166, 255, 0.22);
  border-color: rgb(88, 166, 255);
  opacity: 1;
}

/* 截图按钮：外观跟「风格」「画图」同一套（.draw-toggle.text-toggle），这里只管生成中的状态 */
.controls .shot-btn:disabled { cursor: wait; opacity: 0.6; }

.controls-more {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
}
.controls-more-toggle {
  display: none;
  background: var(--surface-3) !important;
  color: var(--ink) !important;
  border: 1px solid var(--grid) !important;
  font-weight: 500 !important;
  padding: 0 14px !important;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
}

/* ── Legend ── */
.legend {
  display: flex;
  gap: 14px;
  padding: 4px 2px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0;
}

.legend .ball {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 3px;
}

.legend .ball.hit   { background: var(--hit);   box-shadow: 0 0 6px rgba(192,57,43,0.5); }
.legend .ball.hit-a { background: var(--accent); box-shadow: 0 0 6px rgba(192,57,43,0.5); }
.legend .ball.hit-b { background: var(--blue);   box-shadow: 0 0 6px rgba(88,166,255,0.5); }
.legend .ball.hit-c { background: var(--green);  box-shadow: 0 0 6px rgba(63,185,80,0.5); }
.legend .ball.miss  { background: var(--surface-3); border: 1px solid var(--grid); }
.legend .ball.sum   { background: var(--sum); }

/* ── View switch ── */
.view-switch {
  display: flex;
  gap: 6px;
  margin: 6px 0;
  flex-wrap: wrap;
  align-items: center;
}
.view-switch-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.view-select-mobile {
  display: none;
  flex: 1;
  min-height: 38px;
  padding: 0 26px 0 10px;   /* 右边给下拉箭头留位，别压住文字 */
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.view-switch-btn {
  min-height: 30px;
  padding: 0 14px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: all 150ms;
}

.view-switch-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.view-switch-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.hidden-view { display: none; }

/* ── Hecha summary chips ── */
.hecha-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 6px 0;
  padding: 10px 12px;
  align-items: center;
}

.stats-copy { flex: none; }
.stats-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.stat-chip {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--blue-soft);
  border: 1px solid rgba(88, 166, 255, 0.2);
}

.stat-chip span  { color: var(--muted); font-size: 12px; }
.stat-chip strong { color: var(--blue); font-size: 12px; font-family: var(--font-mono); }

/* ── Table card ── */
.table-card { overflow: hidden; margin-top: 6px; }
.hecha-card { margin-top: 8px; }

.table-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 90px);
  /* 横向 contain：左右滑到边不外传，避免触发触控板的「侧滑返回」。
     纵向必须放开链式滚动（默认 auto）：桌面端表格上方还有 topnav+控制条+
     图例+标签约 210px，容器底部本来就探出视口约 120px；纵向也 contain 的话，
     鼠标停在表格上滚到内部底部后滚动不再传给页面，页面永远滚不下去，
     最后几行统计（平均遗漏/最大遗漏/最大连出/欲出几率）就再也露不出来 —
     表现就是「滑到底了但还没到底」。手机端(≤768px)是锁页 flex 布局，
     另有 overscroll-behavior: none，不受这里影响。 */
  overscroll-behavior-x: contain;
  /* flex 行布局：.frozen-col（冻结首列克隆）+ 主表。克隆负 margin 归零占位。 */
  display: flex;
  align-items: flex-start;
}

/* Custom scrollbar */
.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: var(--surface); }
.table-wrap::-webkit-scrollbar-thumb { background: var(--grid); border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Context bar ── */
.context-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  padding: 0 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--grid);
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 10;
  border-radius: 13px 13px 0 0;
}

.hecha-context { border-radius: 13px 13px 0 0; }

.context-label  { font-size: 12px; color: var(--muted); }
.context-bar strong { color: var(--blue); font-size: 12px; font-weight: 600; }
.context-divider { color: var(--dim); }

/* ── Table base ── */
table {
  width: max-content;
  min-width: 100%;
  /* separate (not collapse) so position:sticky 在 iOS Safari/WKWebView 的
     表格单元格上才可靠生效（collapse 下 sticky-td 会失效，期号列冻结不住）。
     单元格只画 右/下 边框 + 表格补 上/左 外边框，效果与 collapse 等价、不重线。 */
  border-collapse: separate;
  border-spacing: 0;
  border-top: 1px solid var(--grid-soft);
  border-left: 1px solid var(--grid-soft);
  background: var(--bg);
  table-layout: auto;
}

thead th {
  background: var(--surface-2);
  color: var(--muted);
  vertical-align: middle;
  /* Sticky so column headers stay aligned with data as the user scrolls.
     Each row's `top` is the running sum of the preceding header-row
     heights — keeps every row anchored without overlap.
     可由「表头固定」开关关掉（body.no-sticky-head），默认开。 */
  position: sticky;
  z-index: 9;
}

/* 表头固定 = 关：表头退回普通流，随内容滚走。各行的 top 保留但对 static
   无效，无需清理；冻结首列克隆里的表头同一规则一起生效，两边不会错位。 */
body.no-sticky-head thead th { position: static; }

thead tr:first-child th {
  height: 28px;
  background: var(--surface-3);
  font-size: 11px;
  letter-spacing: 0.04em;
  top: 0;               /* context-bar removed; row 1 sticks to top */
}

thead tr:nth-child(2) th {
  height: 26px;
  background: var(--surface-2);
  font-size: 11px;
  top: 28px;            /* below row 1 (28px) */
}

thead tr:nth-child(3) th {
  height: 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--accent);
  top: 54px;            /* 28 (row 1) + 26 (row 2) */
}

/* 占位 cell for the info area (rowspan=2) — 与右侧表头同底色同边框，
   避免左上角看起来像"透明缺口"。 */
thead th.info-empty {
  background: var(--surface-2);
}

/* 日期列已从渲染中移除 — 期号唯一标识每一期，日期冗余 */

thead tr:nth-child(3) th.single-subhead {
  background: var(--surface-2);
}

/* ── 左上角信息列表头（期号/开奖号）：视觉合并成一格跨三行 ──
   row3 的标签格用 ::before 把上方两行的 info-empty 占位盖住（同底色、
   无中缝），标签再上移到整块的垂直居中 — 观感即一个跨三行的表头格。
   ::before 属于标签格本身 → 点整块任意位置都能触发 期号/日期 切换。
   偏移量 = 上方两行行高之和（桌面 28+26；≤768px 时 22+22，见媒体查询）。 */
thead tr:nth-child(3) th.single-subhead::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -54px;
  height: 54px;
  background: var(--surface-2);
}
thead tr:nth-child(3) th.single-subhead > span {
  position: relative;
  top: -27px;
}

tbody td {
  background-color: var(--surface);
}

tbody tr:nth-child(even) td {
  background-color: var(--row-alt);
}

tbody tr:hover td {
  background-color: var(--blue-soft) !important;
  transition: background-color 80ms;
}

th, td {
  height: 32px;
  padding: 0 3px;
  text-align: center;
  /* 仅右/下边框 — 配合 border-collapse: separate 不会与相邻单元格重线 */
  border-right: 1px solid var(--grid-soft);
  border-bottom: 1px solid var(--grid-soft);
  font-size: 11px;
  vertical-align: middle;
}

/* Column widths — info (期号 / 开奖号；日期列已移除)
   ⚠ 必须带 #trend-table 作用域。不带作用域时它命中**每张表**的第 1/2 列，
   且权重 (0,2,3) 高过类选择器 —— 快乐8 基本走势曾经没有奖号列，第 2 列正好
   是号码「01」，于是被钉成 110px，跟旁边 33px 的兄弟列完全对不上。
   其它表各有自己的一份：.grid-table / #zxfx-table / .ssq-table。 */
#trend-table thead tr:nth-child(3) th:nth-child(1),
#trend-table tbody td:nth-child(1) {
  width: 92px; min-width: 92px; max-width: 92px;
}

#trend-table thead tr:nth-child(3) th:nth-child(2),
#trend-table tbody td:nth-child(2) {
  width: 110px; min-width: 110px; max-width: 110px;
}

/* Column widths — digit cells (col 3-32 are now the 30 digit cells 0-9 ×3) */
thead tr:nth-child(3) th:nth-child(n+3):nth-child(-n+32),
tbody td:nth-child(n+3):nth-child(-n+32) {
  width: 30px; min-width: 30px; max-width: 30px;
  height: 32px; padding: 0;
}

/* Column widths — metric area (cols 33-47): keep them tight but readable */
#trend-table thead tr:nth-child(3) th:nth-child(n+33),
#trend-table tbody td:nth-child(n+33) {
  width: 38px; min-width: 38px;
  font-size: 11px; padding: 0 2px;
}
/* Form hit-cells (cols 36-40) — narrow uniform width */
#trend-table thead tr:nth-child(3) th:nth-child(n+36):nth-child(-n+40),
#trend-table tbody td:nth-child(n+36):nth-child(-n+40) {
  width: 40px; min-width: 40px; max-width: 40px;
  padding: 0;
}
/* 大中小比 (col 47) — needs more room for "1:2:0" */
#trend-table thead tr:nth-child(3) th:nth-child(47),
#trend-table tbody td:nth-child(47) {
  width: 46px; min-width: 46px;
}
/* 大小 / 奇偶 (cols 41, 42) — 3 Chinese chars per badge need wider cells */
#trend-table thead tr:nth-child(3) th:nth-child(41),
#trend-table tbody td:nth-child(41),
#trend-table thead tr:nth-child(3) th:nth-child(42),
#trend-table tbody td:nth-child(42) {
  width: 50px; min-width: 50px; max-width: 50px;
}
/* 012路 (col 43) — 3 digits, slight extra margin for the badge border */
#trend-table thead tr:nth-child(3) th:nth-child(43),
#trend-table tbody td:nth-child(43) {
  width: 44px; min-width: 44px;
}

/* ── Frozen first column (期号) ───────────────────────────────────────
   横向滚动时让「期号」列始终可见。
   实现：app.js rebuildFrozenCol 把第一列克隆成 .frozen-col（sticky-left 的
   div 包一张单列 .frozen-clone 表），作为 .table-wrap 的第一个 flex 子元素、
   负 margin-right 归零占位 → 主表仍从 x=0 排布，克隆悬浮其上。
   吸附全由合成器原生驱动（iOS 对 div 的 sticky 可靠；表格 tbody 单元格不行），
   横竖滚动路径上没有任何 JS，不抖不晃。
   z-index：.frozen-col 12 > 表头 9 > 正文 0；克隆内部表头 9 > 克隆正文。 */
.frozen-col {
  position: sticky;
  left: 0;
  z-index: 12;
  flex: 0 0 auto;
  /* 不能用 overflow: hidden — 会把 holder 变成滚动容器，克隆表头的
     sticky-top 就不再相对 .table-wrap 吸附。宽度已由单元格重置压住。 */
  box-shadow: 1px 0 0 var(--grid);
}
.frozen-clone {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  border-top: 1px solid var(--grid-soft);
  border-left: 1px solid var(--grid-soft);
  /* 表级不铺底色 — 不透明度由各单元格自己的背景保证，
     这样 .frozen-hole（不冻结的整行横跨行）才能真正透出下层。 */
}
/* 克隆单元格宽度一律交给唯一列（=holder 宽），压掉按 nth-child 命中的通用列宽
   （那些规则是给真表写的，克隆里会把 64px 列撑成 92px 从 holder 溢出）。 */
.frozen-clone th,
.frozen-clone td {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
}
/* 整行横跨的分节标题 / 按钮行不冻结：克隆占位透明，露出下层真实行 */
.frozen-clone .frozen-hole {
  background: none !important;
  border-right-color: transparent;
  border-bottom-color: transparent;
}

/* ── Zone titles ── */
.zone-title {
  background: var(--surface-3);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.digit-head {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  font-weight: 600;
  background: var(--surface);
  font-family: var(--font-mono);
}

.info-title   { text-align: center; }
.info-subtitle { background: var(--surface-2); }

.dist-title {
  background: rgba(88, 166, 255, 0.08);
  color: var(--blue) !important;
  border-bottom: 1px solid rgba(88, 166, 255, 0.25) !important;
}

.metric-title {
  background: rgba(63, 185, 80, 0.07);
  color: var(--green) !important;
}

.hecha-title {
  background: rgba(188, 140, 255, 0.08);
  color: var(--purple) !important;
}

.zone-subtitle {
  background: rgba(88, 166, 255, 0.05);
  color: rgba(88, 166, 255, 0.65);
}

.metric-subtitle {
  background: rgba(63, 185, 80, 0.05);
  color: rgba(63, 185, 80, 0.65);
}

.ratio-subtitle {
  background: var(--amber-soft);
  color: var(--amber);
}

.hecha-subtitle {
  background: rgba(188, 140, 255, 0.05);
  color: rgba(188, 140, 255, 0.65);
}

/* ── Data cells ── */
.issue-cell {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  font-size: 12px;
  color: var(--muted);
}

/* ── 期号 / 日期 列切换 ── 单元格两个值都渲染，body.issue-col-date 控制显隐。
   点表头（真表或冻结克隆里的副本均可）切换，见 app.js 的委托监听。 */
.issue-cell .issue-date,
th.issue-head .issue-date { display: none; }
body.issue-col-date .issue-cell .issue-num,
body.issue-col-date th.issue-head .issue-num { display: none; }
body.issue-col-date .issue-cell .issue-date,
body.issue-col-date th.issue-head .issue-date { display: inline; }

.issue-cell .issue-date { white-space: nowrap; }
.issue-cell .issue-wd {
  font-style: normal;
  margin-left: 3px;
  color: var(--dim);
  font-size: 10px;
}
/* 周六/周日 淡红标记，纵向扫日期时好定位 */
.issue-cell .issue-wd.wd-weekend { color: rgba(192, 57, 43, 0.75); }

th.issue-head {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}
th.issue-head .issue-swap {
  margin-left: 3px;
  color: var(--dim);
  font-size: 10px;
}
th.issue-head:hover .issue-swap { color: var(--blue); }

.date-cell {
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.3;
}

.date-cell strong {
  display: inline;
  color: var(--ink);
}

.date-cell span {
  display: inline;
  margin-left: 3px;
  color: var(--dim);
  font-size: 11px;
}

.open-cell strong {
  font-size: 14px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
}

/* Pair-sum / pair-diff derived values — dedicated column right after 开奖号 in
   两码合 / 两码差 / 任意两码合 / 任意两码差. Blue mono so it reads as "derived". */
.grid-table thead th.open-extra-head,
.grid-table tbody td.open-extra-cell {
  width: 80px; min-width: 80px; max-width: 80px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--blue);
  letter-spacing: 0.08em;
  font-weight: 600;
  white-space: nowrap;
}
.grid-table thead th.open-extra-head { color: var(--muted); font-weight: 600; font-size: 11px; }
/* 试机号走势：试机号里与开奖号配上的那几位。列本身是蓝色，配上的换成主色，
   再加下划线 —— 单靠红蓝两色在 11px 粗体等宽字上不够醒目，而且白纸黑字皮肤
   会把字色统统收成黑色，那时只剩下划线能区分。 */
.trial-hit {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
/* 试机号列自己定宽。注意上面 80px / 手机 64px 那两条其实从来没生效过：派生列
   正好是第 3 列，被「第 3 列起」的号码列宽（桌面 32px、手机 24px !important）
   压住了 —— 两码合等视图的三位数恰好塞得下，所以一直没人发现。试机号列的
   表头「试机号」三个字塞不下，用表 id 把它单独撑开；!important 是为了压过
   手机那条 !important。别的视图不动。 */
#trial-table thead tr:nth-child(3) th.open-extra-head,
#trial-table tbody td.open-extra-cell {
  width: 52px !important; min-width: 52px !important; max-width: 52px !important;
}
/* 自定义条件走势图：组标题是 App 里的规则文字（「(百 + 十) % 10 = 个」这种），
   可能比两列 44px 宽得多 —— 允许折行，不然会压到隔壁组上。 */
#custom-table thead .grid-group-title {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
  font-size: 12px;
  padding: 4px;
}
.custom-rule-list { margin: 6px 0 0; padding-left: 20px; }
.custom-rule-list li { margin: 2px 0; }
.custom-rule-meta { color: var(--dim); }
.custom-rule-skip { margin-top: 8px; }
/* 试机号走势：某一家这期没有试机号 —— 试机号列一个淡灰的「—」，那一组的
   四格打细斜纹，和「没开出」的空白格区分开。 */
.trial-none { color: var(--dim); font-weight: 400; }
.grid-table tbody td.omit.grid-nodata {
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--grid-soft) 5px 6px);
}
/* 带 rowFilter 的网格视图（试机号）在所选期数内一行都没有时的占位行 */
.grid-table tbody tr.grid-empty-row td {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
}

/* ── 走势图说明块 ── 卡片底部，告诉用户每列的含义 (AC值/五行/重邻等) */
.view-desc {
  padding: 10px 16px 12px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  border-top: 1px solid var(--grid);
  background: var(--surface-2);
  border-radius: 0 0 12px 12px;
}
.view-desc strong {
  color: var(--ink);
  font-weight: 600;
  margin: 0 1px;
}
.view-desc-label {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.trial-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(88, 166, 255, 0.10);
  border: 1px solid rgba(88, 166, 255, 0.22);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.open-cell, .group-cell, .issue-cell, .date-cell { font-weight: 600; }

/* ── Hit badge ── */
.hit-cell {
  position: relative;
  color: transparent;
}

/* 球(ball)样式 — 参考 17500: 径向渐变高光 + 强阴影，立体感更足
   - 顶部偏左 30%/30% 的白色高光点制造光泽
   - 主色作为底色，外发光 + 内描边一起做立体感 */
.hit-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  /* 压在折线 SVG（z-index:1）之上 — 折线从球背后穿过，球面数字不被遮挡 */
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  /* 颜色只在这一处画：各分区/各视图的规则只设 --ball，不再各写一遍渐变。
     这样「小球样式」(body[data-ball]) 才能在一个地方统一换掉所有球的画法。 */
  --ball: var(--hit);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 60%),
    var(--ball);
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-mono);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.05),
    inset 0 -2px 3px rgba(0, 0, 0, 0.18);
}

/* Per-zone hit ball variants — 17500.cn style: ball matches zone identity */
.hit-badge.zone-a {
  --ball: var(--accent);
}
.hit-badge.zone-b {
  --ball: var(--blue);
}
.hit-badge.zone-c {
  --ball: var(--green);
}

/* ── Sum / span badge ── */
.sum-badge {
  display: inline-grid;
  min-width: 22px;
  min-height: 20px;
  padding: 0 4px;
  border-radius: 4px;
  place-items: center;
  background: rgba(88, 166, 255, 0.14);
  color: var(--blue);
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1px solid rgba(88, 166, 255, 0.22);
}

/* ── Pattern tags ── */
.pattern-tag {
  display: inline-grid;
  min-height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(192, 57, 43, 0.2);
  white-space: nowrap;
  letter-spacing: 0;
}

.pattern-tag.neutral {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(63, 185, 80, 0.2);
}

/* ── Ratio tags (奇偶比 / 大小比) ── */
.ratio-tag {
  display: inline-grid;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  place-items: center;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid rgba(227, 179, 65, 0.2);
  letter-spacing: 0.04em;
}

.ratio-tag.alt {
  background: var(--purple-soft);
  color: var(--purple);
  border-color: rgba(188, 140, 255, 0.2);
}

/* ── Omission values ── */
.omit {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Group cell ── */
.group-cell {
  font-weight: 600;
  font-size: 11px;
  color: var(--amber);
  white-space: nowrap;
}

/* 5-way detail (豹子/组三/全顺/半顺/杂六) — distinct color per class */
.group-cell.gd-baozi    { color: #c0392b; font-weight: 600; }   /* 红，最罕见 */
.group-cell.gd-zusan    { color: #c47f00; }                      /* 琥珀 */
.group-cell.gd-quanshun { color: #7c3aed; }                      /* 紫，全顺较少见 */
.group-cell.gd-banshun  { color: #0d6efd; }                      /* 蓝 */
.group-cell.gd-zaliu    { color: #1f9d55; }                      /* 绿，最常见 */

/* ── Hecha badges ── */
.hecha-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  padding: 0 3px;
  place-items: center;
  border-radius: 4px;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1px solid rgba(188, 140, 255, 0.25);
}

.hecha-count-badge {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1px solid rgba(88, 166, 255, 0.25);
}

.hecha-open-cell strong {
  color: var(--purple);
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

.hecha-path { stroke: rgba(188, 140, 255, 0.75); }

/* ── Zone separators (main trend table) ── 2px coloured rules at every zone
   boundary so the eye can pick the structure out at a glance.
   Indices shifted -1 after 日期 column removal (期号=1, 开奖号=2, digit 百位.0=3). */
#trend-table td:nth-child(3),  #trend-table th:nth-child(3)  { border-left: 2px solid rgba(192, 57, 43, 0.55) !important; }
#trend-table td:nth-child(13), #trend-table th:nth-child(13) { border-left: 2px solid rgba(13, 110, 253, 0.55) !important; }
#trend-table td:nth-child(23), #trend-table th:nth-child(23) { border-left: 2px solid rgba(31, 157, 85, 0.55) !important; }
#trend-table td:nth-child(33), #trend-table th:nth-child(33) { border-left: 2px solid rgba(148, 163, 184, 0.55) !important; }
#trend-table td:nth-child(36), #trend-table th:nth-child(36) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }
#trend-table td:nth-child(41), #trend-table th:nth-child(41) { border-left: 2px solid rgba(124, 58, 237, 0.55) !important; }
#trend-table td:nth-child(44), #trend-table th:nth-child(44) { border-left: 2px solid rgba(245, 158, 11, 0.55) !important; }
#trend-table td:nth-child(48), #trend-table th:nth-child(48) { border-left: 2px solid rgba(56, 189, 248, 0.55) !important; }

/* 表头 1-2 行是 colspan 合并格，上面按「第 N 列」写的规则在这两行会错位
   （分区竖线在表头断开、row2 第 3 格还被误染成红）— 按行逐格显式补线，
   高特异性压掉误命中，保证每条竖线贯通三行表头到正文。
   Row 1 cells: 信息(1,2) | 号码分布(3,红✓通用规则已中) | 数值(4) | 形态(5) | 比值(6) | 扩展(7) */
#trend-table thead tr:nth-child(1) th:nth-child(4) { border-left: 2px solid rgba(148, 163, 184, 0.55) !important; }
#trend-table thead tr:nth-child(1) th:nth-child(5) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }
#trend-table thead tr:nth-child(1) th:nth-child(6) { border-left: 2px solid rgba(245, 158, 11, 0.55) !important; }
#trend-table thead tr:nth-child(1) th:nth-child(7) { border-left: 2px solid rgba(56, 189, 248, 0.55) !important; }
/* Row 2 cells: 百位(1) | 十位(2) | 个位(3) */
#trend-table thead tr:nth-child(2) th:nth-child(1) { border-left: 2px solid rgba(192, 57, 43, 0.55) !important; }
#trend-table thead tr:nth-child(2) th:nth-child(2) { border-left: 2px solid rgba(13, 110, 253, 0.55) !important; }
#trend-table thead tr:nth-child(2) th:nth-child(3) { border-left: 2px solid rgba(31, 157, 85, 0.55) !important; }

/* ── Zone background tints (matches 17500.cn alternation; layered via bg-image) ── */
/* 百位 cols 3-12: red tint */
#trend-table tbody td:nth-child(n+3):nth-child(-n+12) {
  background-image: linear-gradient(rgba(192, 57, 43, 0.06), rgba(192, 57, 43, 0.06));
}
/* 十位 cols 13-22: blue tint */
#trend-table tbody td:nth-child(n+13):nth-child(-n+22) {
  background-image: linear-gradient(rgba(13, 110, 253, 0.07), rgba(13, 110, 253, 0.07));
}
/* 个位 cols 23-32: green tint */
#trend-table tbody td:nth-child(n+23):nth-child(-n+32) {
  background-image: linear-gradient(rgba(31, 157, 85, 0.07), rgba(31, 157, 85, 0.07));
}
/* Dark theme uses softer alpha for the same tints */
body.dark #trend-table tbody td:nth-child(n+3):nth-child(-n+12) {
  background-image: linear-gradient(rgba(192, 57, 43, 0.06), rgba(192, 57, 43, 0.06));
}
body.dark #trend-table tbody td:nth-child(n+13):nth-child(-n+22) {
  background-image: linear-gradient(rgba(88, 166, 255, 0.08), rgba(88, 166, 255, 0.08));
}
body.dark #trend-table tbody td:nth-child(n+23):nth-child(-n+32) {
  background-image: linear-gradient(rgba(63, 185, 80, 0.07), rgba(63, 185, 80, 0.07));
}

/* 形态 5-cell hit-track (cols 36-40): subtle amber tint */
#trend-table tbody td:nth-child(n+36):nth-child(-n+40) {
  background-image: linear-gradient(rgba(196, 127, 0, 0.05), rgba(196, 127, 0, 0.05));
}
body.dark #trend-table tbody td:nth-child(n+36):nth-child(-n+40) {
  background-image: linear-gradient(rgba(251, 191, 36, 0.06), rgba(251, 191, 36, 0.06));
}

/* Per-category hit badge color (cols 36=豹子, 37=组三, 38=全顺, 39=半顺, 40=杂六)
   球样式：径向高光 + 主色，跟主表 .hit-badge 同体系 */
#trend-table tbody td.hit-cell:nth-child(36) .hit-badge { --ball: #c0392b; }
#trend-table tbody td.hit-cell:nth-child(37) .hit-badge { --ball: #c47f00; }
#trend-table tbody td.hit-cell:nth-child(38) .hit-badge { --ball: #7c3aed; }
#trend-table tbody td.hit-cell:nth-child(39) .hit-badge { --ball: #0d6efd; }
#trend-table tbody td.hit-cell:nth-child(40) .hit-badge { --ball: #1f9d55; }
#trend-table tbody td.form-cell .hit-badge {
  min-width: 28px; width: auto; height: 20px; padding: 0 5px;
  font-size: 11px; border-radius: 10px; color: #fff;
  white-space: nowrap;
}

/* Form column header colors (cols 36-40 = 豹子/组三/全顺/半顺/杂六)
   注意: 表头吸顶悬浮在数据上方，背景必须不透明 —
   用 opaque 底色 + linear-gradient 叠 alpha 色，避免下层数据透出。 */
#trend-table thead tr:nth-child(3) th:nth-child(36) { background: var(--bg) linear-gradient(rgba(192, 57, 43, 0.07), rgba(192, 57, 43, 0.07)); color: #c0392b; }
#trend-table thead tr:nth-child(3) th:nth-child(37) { background: var(--bg) linear-gradient(rgba(196, 127, 0, 0.07), rgba(196, 127, 0, 0.07)); color: #c47f00; }
#trend-table thead tr:nth-child(3) th:nth-child(38) { background: var(--bg) linear-gradient(rgba(124, 58, 237, 0.07), rgba(124, 58, 237, 0.07)); color: #7c3aed; }
#trend-table thead tr:nth-child(3) th:nth-child(39) { background: var(--bg) linear-gradient(rgba(13, 110, 253, 0.07), rgba(13, 110, 253, 0.07)); color: #0d6efd; }
#trend-table thead tr:nth-child(3) th:nth-child(40) { background: var(--bg) linear-gradient(rgba(31, 157, 85, 0.07), rgba(31, 157, 85, 0.07)); color: #1f9d55; }

/* Form polyline — neutral grey so colored badges stay readable */
#line-form { stroke: rgba(100, 116, 139, 0.7); stroke-width: 1.4; }

/* Stats footer — keep cells flat (no zone tint) */
#trend-table tfoot td:nth-child(n+4):nth-child(-n+33),
#trend-table tfoot td:nth-child(n+37):nth-child(-n+41) {
  background-image: none;
}

/* Zone-specific header tints for the digit-row (3rd thead row)
   数字列 = 3-12 (百) / 13-22 (十) / 23-32 (个) — 与正文分区着色对齐
   (旧规则删日期列后没跟着 -1，整体错位一列)。
   吸顶表头必须不透明: opaque 底 + gradient 叠 alpha 色。 */
#trend-table thead tr:nth-child(3) th:nth-child(n+3):nth-child(-n+12) {
  background: var(--bg) linear-gradient(var(--accent-soft), var(--accent-soft));
  color: var(--accent);
}
#trend-table thead tr:nth-child(3) th:nth-child(n+13):nth-child(-n+22) {
  background: var(--bg) linear-gradient(var(--blue-soft), var(--blue-soft));
  color: var(--blue);
}
#trend-table thead tr:nth-child(3) th:nth-child(n+23):nth-child(-n+32) {
  background: var(--bg) linear-gradient(var(--green-soft), var(--green-soft));
  color: var(--green);
}

/* Zone subtitle row tints (2nd thead row, 百/十/个 labels — cells 1/2/3) */
#trend-table thead tr:nth-child(2) th:nth-child(1) {
  background: var(--bg) linear-gradient(var(--accent-soft), var(--accent-soft));
  color: var(--accent);
}
#trend-table thead tr:nth-child(2) th:nth-child(2) {
  background: var(--bg) linear-gradient(var(--blue-soft), var(--blue-soft));
  color: var(--blue);
}
#trend-table thead tr:nth-child(2) th:nth-child(3) {
  background: var(--bg) linear-gradient(var(--green-soft), var(--green-soft));
  color: var(--green);
}

/* ── SVG trend overlays ── absolute-position covers BOTH main view's #trend-overlay
   AND every dynamically-mounted grid view (which gets `.grid-overlay`).
   Without `position: absolute` the SVG sits in normal flow AFTER the table, so
   polylines render below the data instead of overlaying it. */
#trend-overlay,
.grid-overlay {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.trend-path {
  fill: none;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  shape-rendering: geometricPrecision;
  vector-effect: non-scaling-stroke;
}

/* Three distinct colors for 百/十/个位 lines */
#line-a { stroke: rgba(229, 57,  53,  0.85); }
#line-b { stroke: rgba(88,  166, 255, 0.85); }
#line-c { stroke: rgba(63,  185, 80,  0.85); }
#line-a-pred { stroke: rgba(229, 57,  53,  0.85); }
#line-b-pred { stroke: rgba(88,  166, 255, 0.85); }
#line-c-pred { stroke: rgba(63,  185, 80,  0.85); }

/* 「我的选号」那一段：虚线 + 略细，跟已经开出来的实线区分开 —— 预测不是结果 */
.trend-path.pred-path {
  stroke-dasharray: 5 4;
  stroke-width: 1.6;
  opacity: 0.85;
}

/* Grid view line colors: group-0 red, group-1 blue, group-2 green */
#span-line-0,
#heche-line-0,
#hecha-diff-line-0 { stroke: rgba(229, 57,  53,  0.85); }
#heche-line-1,
#hecha-diff-line-1 { stroke: rgba(88,  166, 255, 0.85); }
#heche-line-2,
#hecha-diff-line-2 { stroke: rgba(63,  185, 80,  0.85); }

/* ── Grid table column widths ── */
.grid-table thead tr:first-child th { height: 28px; }

/* Grid info cols (期号 / 开奖号；日期列已移除) */
.grid-table thead tr:nth-child(3) th:nth-child(1),
.grid-table tbody td:nth-child(1) {
  width: 92px; min-width: 92px; max-width: 92px;
}
.grid-table thead tr:nth-child(3) th:nth-child(2),
.grid-table tbody td:nth-child(2) {
  width: 62px; min-width: 62px; max-width: 62px;
}
.grid-table thead tr:nth-child(3) th:nth-child(n+3),
.grid-table tbody td:nth-child(n+3) {
  width: 32px; min-width: 32px; max-width: 32px;
}

/* Grid group separators / zone tints — one palette entry per group index.
   Cells in renderGridBody/buildGridHeader get a `grid-zone-N` class; the first
   cell of each group also gets `zone-start` for the 2px coloured rule. */
.grid-table tbody td.grid-zone-0 { background-image: linear-gradient(rgba(192, 57, 43, 0.06),  rgba(192, 57, 43, 0.06)); }
.grid-table tbody td.grid-zone-1 { background-image: linear-gradient(rgba(88, 166, 255, 0.06), rgba(88, 166, 255, 0.06)); }
.grid-table tbody td.grid-zone-2 { background-image: linear-gradient(rgba(63, 185, 80, 0.06),  rgba(63, 185, 80, 0.06)); }
.grid-table tbody td.grid-zone-3 { background-image: linear-gradient(rgba(196, 127, 0, 0.06),  rgba(196, 127, 0, 0.06)); }
/* zone 4-6 复用前 3 个颜色 — 移除紫/粉以保持视觉一致 */
.grid-table tbody td.grid-zone-4 { background-image: linear-gradient(rgba(192, 57, 43, 0.06),  rgba(192, 57, 43, 0.06)); }
.grid-table tbody td.grid-zone-5 { background-image: linear-gradient(rgba(88, 166, 255, 0.06), rgba(88, 166, 255, 0.06)); }
.grid-table tbody td.grid-zone-6 { background-image: linear-gradient(rgba(63, 185, 80, 0.06),  rgba(63, 185, 80, 0.06)); }
.grid-table tbody td.grid-zone-7 { background-image: linear-gradient(rgba(196, 127, 0, 0.06),  rgba(196, 127, 0, 0.06)); }

/* Zone-start: 2px coloured divider at the first column of each group. */
/* Row1 超级标题（号码分布）的左边界 = 第一组 zone-0 起点，补红线保持贯通 */
.grid-table thead th.dist-title { border-left: 2px solid rgba(192, 57, 43, 0.55) !important; }
.grid-table .zone-start.grid-zone-0 { border-left: 2px solid rgba(192, 57, 43, 0.55) !important; }
.grid-table .zone-start.grid-zone-1 { border-left: 2px solid rgba(88, 166, 255, 0.55) !important; }
.grid-table .zone-start.grid-zone-2 { border-left: 2px solid rgba(63, 185, 80, 0.55) !important; }
.grid-table .zone-start.grid-zone-3 { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }
.grid-table .zone-start.grid-zone-4 { border-left: 2px solid rgba(192, 57, 43, 0.55) !important; }
.grid-table .zone-start.grid-zone-5 { border-left: 2px solid rgba(88, 166, 255, 0.55) !important; }
.grid-table .zone-start.grid-zone-6 { border-left: 2px solid rgba(63, 185, 80, 0.55) !important; }
.grid-table .zone-start.grid-zone-7 { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }

/* Grid group title in header — keep the existing soft blue tint as default
   but the per-zone colour scheme tints individual group titles below. */
.grid-group-title {
  background: var(--bg) linear-gradient(rgba(88, 166, 255, 0.06), rgba(88, 166, 255, 0.06));
  color: rgba(88, 166, 255, 0.65);
}
/* 吸顶悬浮，opaque 底 + gradient 叠 alpha 色防透出 */
.grid-table thead .grid-group-title.grid-zone-0 { background: var(--bg) linear-gradient(rgba(192, 57, 43, 0.10), rgba(192, 57, 43, 0.10));  color: rgba(192, 57, 43, 0.85); }
.grid-table thead .grid-group-title.grid-zone-1 { background: var(--bg) linear-gradient(rgba(88, 166, 255, 0.10), rgba(88, 166, 255, 0.10)); color: rgba(88, 166, 255, 0.85); }
.grid-table thead .grid-group-title.grid-zone-2 { background: var(--bg) linear-gradient(rgba(63, 185, 80, 0.10), rgba(63, 185, 80, 0.10));  color: rgba(63, 185, 80, 0.85); }
.grid-table thead .grid-group-title.grid-zone-3 { background: var(--bg) linear-gradient(rgba(196, 127, 0, 0.10), rgba(196, 127, 0, 0.10));  color: rgba(196, 127, 0, 0.85); }
.grid-table thead .grid-group-title.grid-zone-4 { background: var(--bg) linear-gradient(rgba(192, 57, 43, 0.10), rgba(192, 57, 43, 0.10));  color: rgba(192, 57, 43, 0.85); }
.grid-table thead .grid-group-title.grid-zone-5 { background: var(--bg) linear-gradient(rgba(88, 166, 255, 0.10), rgba(88, 166, 255, 0.10)); color: rgba(88, 166, 255, 0.85); }
.grid-table thead .grid-group-title.grid-zone-6 { background: var(--bg) linear-gradient(rgba(63, 185, 80, 0.10), rgba(63, 185, 80, 0.10));  color: rgba(63, 185, 80, 0.85); }
.grid-table thead .grid-group-title.grid-zone-7 { background: var(--bg) linear-gradient(rgba(196, 127, 0, 0.10), rgba(196, 127, 0, 0.10));  color: rgba(196, 127, 0, 0.85); }


/* ═══ 组选分析图 (zxfx) custom layout ═══════════════════════ */
/* Columns: info(4) + 左延伸(5) + 组选号码(10) + 右延伸(5) + 组选分布(3) + 升降序(5) = 32 */
/* Children indices: 1..4 info | 5..9 左延伸 | 10..19 组选号码 | 20..24 右延伸 | 25..27 组选分布 | 28..32 升降序 */

/* Lock every trend table to natural width — prevent base `min-width: 100%`
   from stretching columns and ignoring per-cell max-width when viewport is
   wider than the table (the cause of large blank gaps on wide displays). */
#trend-table, #zxfx-table, .grid-table {
  table-layout: fixed;
  width: max-content;
  min-width: 0;
}

/* Zxfx info cols — 2 cols only after 日期 and 试机号 removal: 期号 + 奖号 */
#zxfx-table thead tr:nth-child(3) th:nth-child(1),
#zxfx-table tbody td:nth-child(1) {
  width: 78px; min-width: 78px; max-width: 78px;
}
#zxfx-table thead tr:nth-child(3) th:nth-child(2),
#zxfx-table tbody td:nth-child(2) {
  width: 62px; min-width: 62px; max-width: 62px;
}
/* Digit cells: 左延伸(3..7), 组选号码(8..17), 右延伸(18..22) */
#zxfx-table thead tr:nth-child(3) th:nth-child(n+3):nth-child(-n+22),
#zxfx-table tbody td:nth-child(n+3):nth-child(-n+22) {
  width: 30px; min-width: 30px; max-width: 30px;
  padding: 0;
}
/* 组选分布 (23..25) */
#zxfx-table thead tr:nth-child(3) th:nth-child(n+23):nth-child(-n+25),
#zxfx-table tbody td:nth-child(n+23):nth-child(-n+25) {
  width: 40px; min-width: 40px; max-width: 40px;
  padding: 0;
}
/* 升降序 (26..30) — 2-char labels (上山/下山) need a slightly wider cell */
#zxfx-table thead tr:nth-child(3) th:nth-child(n+26):nth-child(-n+30),
#zxfx-table tbody td:nth-child(n+26):nth-child(-n+30) {
  width: 40px; min-width: 40px; max-width: 40px;
  padding: 0;
}
/* 数值指标 (31..33: 和值/和尾/跨度) */
#zxfx-table thead tr:nth-child(3) th:nth-child(n+31):nth-child(-n+33),
#zxfx-table tbody td:nth-child(n+31):nth-child(-n+33) {
  width: 38px; min-width: 38px; max-width: 38px;
  padding: 0 2px;
}
/* 形态指标 (34..38: 豹子/组三/全顺/半顺/杂六) */
#zxfx-table thead tr:nth-child(3) th:nth-child(n+34):nth-child(-n+38),
#zxfx-table tbody td:nth-child(n+34):nth-child(-n+38) {
  width: 40px; min-width: 40px; max-width: 40px;
  padding: 0;
}

/* Zone background tints — each conceptual block uses its own tinted backdrop
   so it's distinguishable even with default row striping. */
#zxfx-table tbody td:nth-child(n+3):nth-child(-n+7),
#zxfx-table tbody td:nth-child(n+18):nth-child(-n+22) {
  background-image: linear-gradient(rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.12));
}
#zxfx-table tbody td:nth-child(n+8):nth-child(-n+17) {
  background-image: linear-gradient(rgba(192, 57, 43, 0.07), rgba(192, 57, 43, 0.07));
}
#zxfx-table tbody td:nth-child(n+23):nth-child(-n+25) {
  background-image: linear-gradient(rgba(196, 127, 0, 0.08), rgba(196, 127, 0, 0.08));
}
#zxfx-table tbody td:nth-child(n+26):nth-child(-n+30) {
  background-image: linear-gradient(rgba(124, 58, 237, 0.08), rgba(124, 58, 237, 0.08));
}
#zxfx-table tbody td:nth-child(n+31):nth-child(-n+33) {
  background-image: linear-gradient(rgba(31, 157, 85, 0.06), rgba(31, 157, 85, 0.06));
}
#zxfx-table tbody td:nth-child(n+34):nth-child(-n+38) {
  background-image: linear-gradient(rgba(196, 127, 0, 0.06), rgba(196, 127, 0, 0.06));
}

/* Zone dividers — thick coloured rules where one concept hands off to the next.
   Indices shifted by -2 after dropping 试机号 & 日期: info now spans cols 1-2. */
#zxfx-table td:nth-child(3),  #zxfx-table th:nth-child(3)  { border-left: 2px solid rgba(148, 163, 184, 0.55) !important; }
#zxfx-table td:nth-child(8),  #zxfx-table th:nth-child(8)  { border-left: 3px double rgba(192, 57, 43, 0.7) !important; }
#zxfx-table td:nth-child(18), #zxfx-table th:nth-child(18) { border-left: 3px double rgba(192, 57, 43, 0.7) !important; }
#zxfx-table td:nth-child(23), #zxfx-table th:nth-child(23) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }
#zxfx-table td:nth-child(26), #zxfx-table th:nth-child(26) { border-left: 2px solid rgba(124, 58, 237, 0.55) !important; }
/* 数值 col30 / 形态 col33 — 升降序从 5 列缩到 4 列后这两条曾滞留在 31/34，
   与表头 1-2 行按真实边界补的线错开一列出现「双线」 */
#zxfx-table td:nth-child(31), #zxfx-table th:nth-child(31) { border-left: 2px solid rgba(31, 157, 85, 0.55) !important; }
#zxfx-table td:nth-child(34), #zxfx-table th:nth-child(34) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }

/* 表头 1-2 行合并格逐格补线（同主表：列号规则在合并行会错位）。
   Row 1: 信息(1,2) | 号码分布(3,灰✓通用已中) | 组选形态(4) | 数值(5) | 形态(6)
   Row 2: 左延伸(1) | 组选号码(2) | 右延伸(3) | 组选分布(4) | 升降序(5) | 数值(6) | 形态(7) */
#zxfx-table thead tr:nth-child(1) th:nth-child(4) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }
#zxfx-table thead tr:nth-child(1) th:nth-child(5) { border-left: 2px solid rgba(31, 157, 85, 0.55) !important; }
#zxfx-table thead tr:nth-child(1) th:nth-child(6) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }
#zxfx-table thead tr:nth-child(2) th:nth-child(1) { border-left: 2px solid rgba(148, 163, 184, 0.55) !important; }
#zxfx-table thead tr:nth-child(2) th:nth-child(2) { border-left: 3px double rgba(192, 57, 43, 0.7) !important; }
#zxfx-table thead tr:nth-child(2) th:nth-child(3) { border-left: 3px double rgba(192, 57, 43, 0.7) !important; }
#zxfx-table thead tr:nth-child(2) th:nth-child(4) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }
#zxfx-table thead tr:nth-child(2) th:nth-child(5) { border-left: 2px solid rgba(124, 58, 237, 0.55) !important; }
#zxfx-table thead tr:nth-child(2) th:nth-child(6) { border-left: 2px solid rgba(31, 157, 85, 0.55) !important; }
#zxfx-table thead tr:nth-child(2) th:nth-child(7) { border-left: 2px solid rgba(196, 127, 0, 0.55) !important; }

/* Top-row zone-title tints — 吸顶悬浮，opaque 底 + gradient 叠 alpha 色防透出 */
#zxfx-table .zxfx-ext-title   { background: var(--bg) linear-gradient(rgba(148, 163, 184, 0.10), rgba(148, 163, 184, 0.10)); color: var(--dim) !important; border-bottom: 1px solid rgba(148, 163, 184, 0.3) !important; }
#zxfx-table .zxfx-mid-title   { background: var(--bg) linear-gradient(rgba(192, 57, 43, 0.10), rgba(192, 57, 43, 0.10));  color: var(--accent) !important; border-bottom: 1px solid rgba(192, 57, 43, 0.3) !important; }
#zxfx-table .zxfx-dist-title  { background: var(--bg) linear-gradient(rgba(196, 127, 0, 0.12), rgba(196, 127, 0, 0.12));  color: #c47f00 !important;       border-bottom: 1px solid rgba(196, 127, 0, 0.35) !important; }
#zxfx-table .zxfx-shape-title { background: var(--bg) linear-gradient(rgba(124, 58, 237, 0.10), rgba(124, 58, 237, 0.10)); color: #7c3aed !important;       border-bottom: 1px solid rgba(124, 58, 237, 0.3) !important; }
#zxfx-table .zxfx-form-title  { background: var(--bg) linear-gradient(rgba(196, 127, 0, 0.12), rgba(196, 127, 0, 0.12));  color: #c47f00 !important;       border-bottom: 1px solid rgba(196, 127, 0, 0.35) !important; }
#zxfx-table .zxfx-gd-title    { background: var(--bg) linear-gradient(rgba(196, 127, 0, 0.10), rgba(196, 127, 0, 0.10));  color: #c47f00 !important;       border-bottom: 1px solid rgba(196, 127, 0, 0.3) !important; }

/* Sub-header label tints */
#zxfx-table thead tr:nth-child(3) th.zxfx-ext-head   { background: var(--bg) linear-gradient(rgba(148, 163, 184, 0.05), rgba(148, 163, 184, 0.05)); color: rgba(148, 163, 184, 0.85); }
#zxfx-table thead tr:nth-child(3) th.zxfx-mid-head   { background: var(--bg) linear-gradient(rgba(192, 57, 43, 0.06), rgba(192, 57, 43, 0.06));   color: rgba(192, 57, 43, 0.85); }
#zxfx-table thead tr:nth-child(3) th.zxfx-dist-0-head  { color: #c47f00; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-dist-1-head  { color: #0d6efd; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-dist-2-head  { color: #c0392b; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-shape-0-head { color: #c0392b; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-shape-1-head { color: #1f9d55; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-shape-2-head { color: #c47f00; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-shape-3-head { color: #7c3aed; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-shape-4-head { color: #0d6efd; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-gd-0-head { color: #c0392b; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-gd-1-head { color: #c47f00; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-gd-2-head { color: #7c3aed; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-gd-3-head { color: #0d6efd; font-weight: 600; }
#zxfx-table thead tr:nth-child(3) th.zxfx-gd-4-head { color: #1f9d55; font-weight: 600; }

/* 组选分布 badges */
#zxfx-table .zxfx-dist-0-cell .hit-badge { --ball: #c47f00; }
#zxfx-table .zxfx-dist-1-cell .hit-badge { --ball: #0d6efd; }
#zxfx-table .zxfx-dist-2-cell .hit-badge { --ball: #c0392b; }
#zxfx-table .zxfx-dist-cell .hit-badge {
  min-width: 28px; width: auto; height: 20px; padding: 0 6px;
  font-size: 11px; border-radius: 10px; color: #fff;
  white-space: nowrap;
}

/* 升降序 badges */
#zxfx-table .zxfx-shape-0-cell .hit-badge { --ball: #c0392b; }
#zxfx-table .zxfx-shape-1-cell .hit-badge { --ball: #1f9d55; }
#zxfx-table .zxfx-shape-2-cell .hit-badge { --ball: #c47f00; }
#zxfx-table .zxfx-shape-3-cell .hit-badge { --ball: #7c3aed; }
#zxfx-table .zxfx-shape-4-cell .hit-badge { --ball: #0d6efd; }
#zxfx-table .zxfx-shape-cell .hit-badge {
  min-width: 28px; width: auto; height: 20px; padding: 0 5px;
  font-size: 11px; border-radius: 10px; color: #fff;
  white-space: nowrap;
}

/* 形态指标 badges (5-way 豹子/组三/全顺/半顺/杂六) — match basic-trend palette */
#zxfx-table .zxfx-gd-0-cell .hit-badge { background: #c0392b; box-shadow: 0 0 6px rgba(192,57,43,0.45); }
#zxfx-table .zxfx-gd-1-cell .hit-badge { background: #c47f00; box-shadow: 0 0 6px rgba(196,127,0,0.40); }
#zxfx-table .zxfx-gd-2-cell .hit-badge { background: #7c3aed; box-shadow: 0 0 6px rgba(124,58,237,0.45); }
#zxfx-table .zxfx-gd-3-cell .hit-badge { background: #0d6efd; box-shadow: 0 0 6px rgba(13,110,253,0.45); }
#zxfx-table .zxfx-gd-4-cell .hit-badge { background: #1f9d55; box-shadow: 0 0 6px rgba(31,157,85,0.45); }
#zxfx-table .zxfx-gd-cell .hit-badge {
  min-width: 28px; width: auto; height: 20px; padding: 0 5px;
  font-size: 11px; border-radius: 10px; color: #fff;
  white-space: nowrap;
}

/* 试机号 cell — mono, dim */
#zxfx-table .trial-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  text-align: center;
}

/* Flat stats footer (no zone tint) */
#zxfx-table tfoot td:nth-child(n+5):nth-child(-n+40) {
  background-image: none;
}

/* ── Stats footer ── */
.stat-foot .stat-section-row td {
  background: var(--surface-3);
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--amber);
  height: 24px;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--amber);
  font-family: var(--font-display);
}

.stat-foot .stat-row td { height: 26px; }

.stat-foot .stat-row-count td       { background: rgba(63, 185, 80,  0.05); }
.stat-foot .stat-row-currentOmit td { background: var(--bg); }
.stat-foot .stat-row-avgOmit td     { background: rgba(88,  166, 255, 0.04); }
.stat-foot .stat-row-maxOmit td     { background: rgba(229, 57,  53,  0.04); }

.stat-foot .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: right;
  padding-right: 8px;
  white-space: nowrap;
  background: var(--surface-2) !important;
  border-right: 1px solid var(--grid);
}

.stat-foot .stat-empty {
  background: var(--surface-2) !important;
}

.stat-foot .stat-val {
  font-size: 11px;
  font-family: var(--font-mono);
}

.stat-foot .stat-count       { color: var(--green); font-weight: 600; }
.stat-foot .stat-currentOmit { color: var(--muted); }
.stat-foot .stat-avgOmit     { color: var(--muted); }
.stat-foot .stat-maxOmit     { color: rgba(192, 57, 43, 0.65); }

.stat-foot .stat-omit-fresh {
  background: rgba(63, 185, 80, 0.2) !important;
  color: var(--green) !important;
  font-weight: 600;
}

.stat-foot .stat-omit-due {
  background: rgba(192, 57, 43, 0.18) !important;
  color: #c0392b !important;
  font-weight: 600;
}

/* 最大连出 / 欲出几率 */
.stat-foot .stat-maxConsec { color: var(--muted); }
.stat-foot .stat-consec-hot {
  color: var(--amber) !important;
  font-weight: 600;
}
.stat-foot .stat-dueRatio { color: var(--muted); }
.stat-foot .stat-due-mild {
  color: var(--blue) !important;
  font-weight: 600;
}
.stat-foot .stat-due-strong {
  background: rgba(13, 110, 253, 0.16) !important;
  color: var(--blue) !important;
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   ▼ NEW · 顶部导航 / 智能洞察面板 / 新增视图样式
   ════════════════════════════════════════════════════════════ */

/* ── Top nav ── */
.topnav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 12px;
  margin-top: 6px;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.brand-copy { display: grid; line-height: 1.2; }
.brand-copy strong { font-size: 14px; color: var(--ink); font-weight: 600; }
.brand-copy .brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}

.topnav-links {
  display: flex;
  gap: 4px;
  justify-self: center;
}

.topnav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all 150ms;
  border: 1px solid transparent;
}

.topnav-link:hover {
  background: var(--surface-3);
  color: var(--blue);
  border-color: var(--grid);
}

.topnav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(192, 57, 43, 0.3);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.topnav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--grid);
  background: var(--surface-3);
  color: var(--ink);
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 150ms;
}

.theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: scale(1.05);
}

.theme-icon-sun, .theme-icon-moon { display: none; }
body:not(.dark) .theme-icon-moon { display: inline; }
body.dark .theme-icon-sun { display: inline; }

/* status-dot removed per UI rules — `.topnav-status` carries the label alone. */

/* ── Repeat / adj badges (main row) ── */
.repeat-mark, .adj-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(192, 57, 43, 0.15);
  color: var(--accent);
  border: 1px solid rgba(192, 57, 43, 0.3);
}

.adj-mark {
  background: rgba(227, 179, 65, 0.15);
  color: var(--amber);
  border-color: rgba(227, 179, 65, 0.3);
}

.legend .repeat-mark { width: 16px; height: 16px; font-size: 11px; }

.dim { color: var(--dim); font-size: 11px; }

/* ── Repeat row highlight ── */
/* Combination of a thin red left-edge on the issue cell + a small numeric
   circle showing the actual repeat count (1-3). Severity scales the circle
   shade. The 重号 column (col 46) is still the canonical numeric source. */
.repeat-row td.issue-cell {
  box-shadow: inset 3px 0 0 var(--accent);
}

.repeat-row td.open-cell strong {
  color: var(--accent);
}

/* 期号 / 日期 列：两种状态都居中。
   这里原本是 flex + space-between，且 .issue-num 右对齐 —— 那是给单元格右侧
   一个「重号圆点」(.repeat-circle) 留的位置，而那个功能早就删了，现在没有任何
   代码会生成它。留下的结果是：显示日期时（内容宽度自适应、被 space-between
   顶到左边）贴左、右边一大片空；显示期号时（flex:1 撑满 + text-align:right）
   文字贴右、左边空。去掉 flex，交回给 th,td 的 text-align: center。 */
.issue-cell {
  padding: 0 6px;
}

.issue-cell .issue-num {
  white-space: nowrap;
}


/* ── AC value badge ── */
.ac-badge {
  display: inline-grid;
  min-width: 22px;
  min-height: 18px;
  padding: 0 5px;
  place-items: center;
  border-radius: 4px;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1px solid rgba(188, 140, 255, 0.25);
}

/* ── New ratio variants ── */
.ratio-tag.prime {
  background: rgba(255, 107, 107, 0.10);
  color: #d9745f;
  border-color: rgba(255, 107, 107, 0.25);
}

.ratio-tag.triple {
  background: rgba(56, 189, 248, 0.10);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  font-size: 11px;
  letter-spacing: 0;
}

/* ── New header subtitle ── */
.extra-subtitle {
  background: rgba(188, 140, 255, 0.06);
  color: rgba(188, 140, 255, 0.7);
}

/* ── Grid view: per-cfg cell width via CSS var ── */
.grid-table { --cell-w: 32px; }

.grid-table thead tr:nth-child(3) th:nth-child(n+4),
.grid-table tbody td:nth-child(n+4) {
  width: var(--cell-w);
  min-width: var(--cell-w);
  max-width: var(--cell-w);
}

/* Soft striping for grid views (alternating zone tints) */
.grid-table tbody tr:nth-child(even) td { background-color: var(--row-alt); }

/* hit badge for narrow grid cells (e.g. 质合, 大中小, 012路) */
.hit-badge.grid-hit {
  --ball: var(--accent);
  min-width: 20px;
  width: auto;
  height: 20px;
  padding: 0 4px;
  font-size: 11px;
  border-radius: 10px;
  white-space: nowrap;
}

/* 所有 grid 视图按 zone 索引分色 (对齐主走势图 百/十/个 红蓝绿)，
   循环复用 4 色 (红/蓝/绿/琥珀) — 跳过紫色。 */
.grid-table tbody td.hit-cell.grid-zone-0 .hit-badge,
.grid-table tbody td.hit-cell.grid-zone-4 .hit-badge {
  --ball: rgb(192, 57, 43);
  box-shadow: 0 0 5px rgba(192, 57, 43, 0.4);
}
.grid-table tbody td.hit-cell.grid-zone-1 .hit-badge,
.grid-table tbody td.hit-cell.grid-zone-5 .hit-badge {
  --ball: rgb(88, 166, 255);
  box-shadow: 0 0 5px rgba(88, 166, 255, 0.4);
}
.grid-table tbody td.hit-cell.grid-zone-2 .hit-badge,
.grid-table tbody td.hit-cell.grid-zone-6 .hit-badge {
  --ball: rgb(63, 185, 80);
  box-shadow: 0 0 5px rgba(63, 185, 80, 0.4);
}
.grid-table tbody td.hit-cell.grid-zone-3 .hit-badge,
.grid-table tbody td.hit-cell.grid-zone-7 .hit-badge {
  --ball: rgb(196, 127, 0);
  box-shadow: 0 0 5px rgba(196, 127, 0, 0.4);
}

/* Grid trend path colors per group index — 红/蓝/绿/琥珀 循环，跳过紫色 */
.trend-path.trend-path-0 { stroke: rgba(192, 57, 43, 0.85); }
.trend-path.trend-path-1 { stroke: rgba(88, 166, 255, 0.85); }
.trend-path.trend-path-2 { stroke: rgba(63, 185, 80, 0.85); }
.trend-path.trend-path-3 { stroke: rgba(196, 127, 0, 0.85); }
.trend-path.trend-path-4 { stroke: rgba(192, 57, 43, 0.85); }
.trend-path.trend-path-5 { stroke: rgba(88, 166, 255, 0.85); }
.trend-path.trend-path-6 { stroke: rgba(63, 185, 80, 0.85); }
.trend-path.trend-path-7 { stroke: rgba(196, 127, 0, 0.85); }

/* Single-group views (跨度, 和值, 和尾) — 统一红折线 */
#span-line-0  { stroke: rgba(192, 57, 43, 0.85); }
#hezhi-line-0 { stroke: rgba(192, 57, 43, 0.85); }
#hewei-line-0 { stroke: rgba(192, 57, 43, 0.85); }

/* Wider info/header section for 和值 (28-cell track gets cramped otherwise) */
#hezhi-table .digit-head { font-size: 11px; }
#hezhi-table .hit-badge { font-size: 11px; }

/* Page foot */
.page-foot {
  display: flex;
  justify-content: space-between;
  margin: 16px 4px 4px;
  padding: 8px 14px;
  font-size: 11px;
  color: var(--dim);
  border-top: 1px dashed var(--grid);
}

.page-foot span { font-family: var(--font-mono); }

.view-switch {
  flex-wrap: wrap;
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .page-shell {
    width: calc(100vw - 12px);
    margin: 6px auto 24px;
  }

  .hero { padding: 8px 10px 6px; }

  .controls {
    gap: 6px;
    padding: 6px 8px;
  }

  .controls label { min-width: calc(50% - 6px); }
  .toggle { min-width: auto; }

  th, td {
    height: 28px;
    padding: 0 1px;
    font-size: 11px;
  }

  thead tr:nth-child(3) th:nth-child(n+4):nth-child(-n+33),
  tbody td:nth-child(n+4):nth-child(-n+33) {
    width: 26px; min-width: 26px; max-width: 26px;
    height: 28px; padding: 0;
  }

  .hit-badge { width: 18px; height: 18px; font-size: 11px; }
  .context-bar { min-height: 22px; padding: 0 6px; }

  .topnav { grid-template-columns: 1fr; gap: 8px; padding: 8px 10px; }
  .topnav-links { justify-self: stretch; flex-wrap: wrap; }
  .topnav-link { padding: 4px 10px; font-size: 11px; }
  .topnav-status { justify-self: end; }
}

/* ── 手机端 (≤768px) ── 主要瞄准嵌入 APP 后的浏览体验：
   • Tab 横滑 + snap，14 个 tab 都能触达
   • 期号列 sticky-left，横向滑数字时锚定
   • Insights 单列堆叠
   • 顶 nav / 控制条 全部压缩，腾出表格空间 */
@media (max-width: 768px) {
  body { -webkit-text-size-adjust: 100%; }
  /* ── 锁页布局 ── 页面本身永不滚动（高度钉死 100dvh 的纵向 flex），
     走势表占满剩余空间、只在 .table-wrap 内部滚。
     「整个布局跟着滑动、上方露出空白」从结构上不可能再发生。 */
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .page-shell {
    width: calc(100vw - 4px);
    margin: 0 auto;
    height: 100vh;   /* dvh 不支持时的回退 */
    height: 100dvh;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 2px 0 4px;
    box-sizing: border-box;
  }
  .controls, .view-switch { flex: 0 0 auto; }
  /* 当前视图卡片吃掉剩余高度；隐藏卡片保持 display:none（:not 避免盖掉） */
  .table-card:not(.hidden-view) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
  }
  .table-card .select-panel { flex: 0 0 auto; }
  /* 挂载点不参与布局，让其中的卡片直接成为 page-shell 的 flex 子项。
     锁页布局靠 .table-card 拿到剩余高度、只在 .table-wrap 内部滚；挂载点若是
     普通 block，卡片隔了一层就不是 flex 子项，高度会撑到内容全高，
     scrollHeight == clientHeight → 容器内无可滚内容，而页面本身又 overflow:
     hidden，结果就是整张表完全滑不动。新增挂载点必须一并加进来。 */
  #grid-views-mount,
  #multi-ball-mount { display: contents; }

  /* 手机端（多为 iOS App 内嵌，自带导航栏）隐藏顶部占位较大的区块，
     把首屏让给走势表。桌面端保留全部功能。 */
  .topnav,
  .legend,
  .view-desc,
  .page-foot { display: none; }

  /* 视图切换下拉已并入控制条（期数 | 视图 | ⚙ 一行），
     .view-switch 区块（桌面 pills）整个隐藏，不占高度 */
  .view-select-mobile { display: block; flex: 1 1 auto; min-width: 0; }
  .view-switch { display: none; }

  /* 手机端不放设置入口 — 顶部只留 期数 + 视图 两个下拉。
     折线/遗漏/重号高亮 按默认值走（桌面端仍可调）。 */
  .controls-more-toggle { display: none; }
  .controls-more { display: none !important; }

  /* 截图保留（分享到微信的主要出口），和「风格」「画图」一样是文字按钮 */

  /* Topnav: 双行布局，brand 左 / 状态右 / 链接整行 */
  .topnav {
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 10px;
  }
  .brand-mark { width: 30px; height: 30px; font-size: 12px; border-radius: 7px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy .brand-sub { display: none; }
  .topnav-links { display: none; }
  .topnav-status { font-size: 11px; padding: 3px 8px; }
  .theme-toggle { width: 28px; height: 28px; font-size: 13px; }

  /* 控制条: 期数 | 视图 | 设置 一行。去掉外层卡片框（页面顶部只有这一行，
     无需再包一层盒子），三个控件统一 36px 高 / 9px 圆角 / 1px 细边。
     select 关掉原生外观（iOS 双箭头突兀），换统一的细 chevron。
     「显示期数」文字省掉 — 选项值 "30期" 自解释。 */
  .controls {
    background: none;
    border: none;
    border-radius: 0;
    padding: 4px 2px;
    margin: 0;
    gap: 6px;
    align-items: center;
  }
  .controls label { min-width: auto; display: block; }
  /* 只隐藏「显示期数」标题文字（.controls 的直接子 label） */
  .controls > label > span { display: none; }
  .controls select {
    -webkit-appearance: none;
    appearance: none;
    min-height: 36px;
    padding: 0 26px 0 12px;
    font-size: 13px;
    color: var(--ink);
    background: var(--surface)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2398a2b3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      no-repeat right 10px center / 10px 6px;
    border: 1px solid var(--grid);
    border-radius: 9px;
  }
  .view-select-mobile { font-weight: 500; }

  /* 图例: 横向滚动，不换行 */
  .legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 2px 4px;
    gap: 10px;
    font-size: 11px;
  }
  .legend::-webkit-scrollbar { display: none; }
  .legend > * { flex-shrink: 0; }

  /* Tab 切换: 横向滚动 + snap */
  .view-switch {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    padding-bottom: 4px;
    margin: 4px -2px;
  }
  .view-switch::-webkit-scrollbar { display: none; }
  .view-switch-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 7px;
  }

  /* 表格容器: 吃掉卡片剩余高度（锁页 flex 布局），只在内部滚。
     注意：不要加 -webkit-overflow-scrolling: touch — 它会让 iOS WebKit
     内部的 position: sticky 失效（期号列冻结失败）。
     overscroll-behavior: none 关掉容器自身的橡皮筋回弹 — 顶部下拉时
     整块内容不再跟手位移露出空白（Safari/WKWebView 16+ 支持）。 */
  .table-card { border-radius: 10px; margin-top: 4px; }
  .table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overscroll-behavior: none;
  }
  .context-bar {
    min-height: 24px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 9px 9px 0 0;
    gap: 6px;
  }

  /* 期号列冻结由 .frozen-col 克隆层处理（见 app.js rebuildFrozenCol），
     此处无需任何 sticky-left 规则。 */
  /* 期号列 — 缩到 17500 同等 64px */
  #trend-table thead tr:nth-child(3) th:nth-child(1),
  #trend-table tbody td:nth-child(1),
  .grid-table thead tr:nth-child(3) th:nth-child(1),
  .grid-table tbody td:nth-child(1),
  #zxfx-table thead tr:nth-child(3) th:nth-child(1),
  #zxfx-table tbody td:nth-child(1) {
    width: 64px; min-width: 64px; max-width: 64px;
  }
  /* 开奖号列 — 17500 同等 52px (3 位数字 12px×3 + 留白) */
  #trend-table thead tr:nth-child(3) th:nth-child(2),
  #trend-table tbody td:nth-child(2),
  .grid-table thead tr:nth-child(3) th:nth-child(2),
  .grid-table tbody td:nth-child(2),
  #zxfx-table thead tr:nth-child(3) th:nth-child(2),
  #zxfx-table tbody td:nth-child(2) {
    width: 52px; min-width: 52px; max-width: 52px;
  }
  /* 数字列 — 索引已 -1，对齐 17500 同等的 24px (用 table id 提高特异性，覆盖 desktop 规则) */
  #trend-table thead tr:nth-child(3) th:nth-child(n+3):nth-child(-n+32),
  #trend-table tbody td:nth-child(n+3):nth-child(-n+32),
  .grid-table thead tr:nth-child(3) th:nth-child(n+3),
  .grid-table tbody td:nth-child(n+3),
  #zxfx-table thead tr:nth-child(3) th:nth-child(n+3),
  #zxfx-table tbody td:nth-child(n+3) {
    width: 24px !important; min-width: 24px !important; max-width: 24px !important;
  }
  /* 行高紧凑 — 17500 同等约 26px */
  table th, table td { height: 26px !important; }
  table tbody td, table tfoot td { font-size: 11px; }
  .hit-badge { width: 18px; height: 18px; font-size: 10px; }
  table thead tr:first-child th { height: 22px !important; font-size: 10px; letter-spacing: 0; }
  table thead tr:nth-child(2) th { height: 22px !important; font-size: 10px; }
  table thead tr:nth-child(3) th { height: 22px !important; font-size: 10px; }

  /* 开奖号字号略缩，更挤得下 */
  .open-cell strong { font-size: 12px; letter-spacing: 0.05em; }
  .issue-cell { font-size: 11px; padding: 0 4px; }
  .date-cell { font-size: 10px; }

  /* sticky-top 偏移同步缩小 (与紧凑表头高度匹配) */
  thead tr:nth-child(2) th { top: 22px; }
  thead tr:nth-child(3) th { top: 44px; }
  /* 左上角信息列表头合并块 — 上方两行 22+22 */
  thead tr:nth-child(3) th.single-subhead::before { top: -44px; height: 44px; }
  thead tr:nth-child(3) th.single-subhead > span { top: -22px; }

  /* 派生列宽缩水 */
  .grid-table thead th.open-extra-head,
  .grid-table tbody td.open-extra-cell {
    width: 64px; min-width: 64px; max-width: 64px;
    font-size: 11px; letter-spacing: 0.06em;
  }

  /* 说明块: 更紧凑 */
  .view-desc {
    padding: 8px 10px 10px;
    font-size: 11px;
    line-height: 1.55;
  }
  .view-desc-label { font-size: 10px; padding: 1px 6px; }

  /* 统计页脚字号 */
  .stat-foot .stat-label { font-size: 10px; padding-right: 4px; }
  .stat-foot .stat-val { font-size: 10px; }
}

/* ── 小屏 (≤420px) — 微调更激进 ── */
@media (max-width: 420px) {
  thead tr:nth-child(3) th:nth-child(n+3):nth-child(-n+32),
  tbody td:nth-child(n+3):nth-child(-n+32) {
    width: 22px; min-width: 22px; max-width: 22px;
  }
  .hit-badge { width: 16px; height: 16px; font-size: 9px; }
  .controls button { font-size: 11px; padding: 0 8px; }
  /* select 在 <=768px 那段已经 appearance: none，箭头是画在右侧 10px 处的
     背景图 —— 右内边距不能跟着按钮一起收到 8px，否则箭头直接压在
     「七星彩」「基本走势」这种文字上。只收左边，右边留够箭头的位置。 */
  .controls select { font-size: 11px; padding: 0 24px 0 8px; }
}

/* ════════════════════════════════════════════════════════════
   预选区 (位于最新一期下方) — 用户在此点击数字组合预测，可多行。
   ──────────────────────────────────────────────────────────── */
.sel-row > td {
  background: linear-gradient(rgba(13, 110, 253, 0.07), rgba(13, 110, 253, 0.07)) !important;
  background-color: var(--surface) !important;
  height: 32px;
}
.sel-row:first-of-type > td {
  border-top: 2px solid var(--blue) !important;
}
body.dark .sel-row > td {
  background: linear-gradient(rgba(88, 166, 255, 0.12), rgba(88, 166, 255, 0.12)) !important;
}
.sel-row .sel-label {
  font-weight: 600;
  color: var(--blue);
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.sel-row .sel-cell { position: relative; cursor: pointer; }
.sel-row .sel-hit .hit-badge { opacity: 0.95; }
.sel-row .sel-cell.pickable:hover {
  background: rgba(13, 110, 253, 0.16) !important;
  box-shadow: inset 0 0 0 2px rgba(13, 110, 253, 0.45);
}
.sel-row .sel-actions {
  position: sticky;
  right: 0;
  background: var(--surface) !important;
  z-index: 5;
  padding: 0 4px !important;
  border-left: 1px solid var(--grid-soft);
}
.sel-del-btn {
  background: transparent;
  border: 1px solid var(--grid);
  color: var(--muted);
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.12s;
}
.sel-del-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(192, 57, 43, 0.08);
}
/* + 添加一行预测 — 跨整行的按钮带；按钮 sticky-left 保证视口内一直可见 */
.sel-add-row > td.sel-add-cell {
  padding: 0 !important;
  background: linear-gradient(rgba(13, 110, 253, 0.04), rgba(13, 110, 253, 0.04)) !important;
  border-bottom: 2px solid var(--blue) !important;
  height: 28px;
  text-align: left;
}
.sel-add-btn {
  position: sticky;
  left: 8px;
  background: transparent;
  border: 1px dashed rgba(13, 110, 253, 0.5);
  color: var(--blue);
  border-radius: 12px;
  padding: 3px 14px;
  font-size: 12px;
  margin-left: 8px;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 5;
}
.sel-add-btn:hover {
  background: rgba(13, 110, 253, 0.12);
  border-style: solid;
}
@media (max-width: 768px) {
  .sel-row > td { height: 26px !important; }
  .sel-row .sel-label { font-size: 10px; }
  .sel-del-btn { width: 18px; height: 18px; font-size: 11px; }
  .sel-add-btn { padding: 2px 10px; font-size: 11px; }
}

/* ════════════════════════════════════════════════════════════
   模拟选号 (Pick-to-Bet)
   ──────────────────────────────────────────────────────────── */

/* 可点击 cell：默认仅鼠标手势变化，hover 加蓝环 + 微抬 */
td.pickable { cursor: pointer; user-select: none; transition: box-shadow 0.12s; }
td.pickable:hover {
  background: rgba(13, 110, 253, 0.10);
  box-shadow: inset 0 0 0 2px rgba(13, 110, 253, 0.45);
}
body.dark td.pickable:hover {
  background: rgba(88, 166, 255, 0.14);
  box-shadow: inset 0 0 0 2px rgba(88, 166, 255, 0.55);
}

td.cell-picked {
  position: relative;
  background: rgba(13, 110, 253, 0.10);
  box-shadow: inset 0 0 0 2px rgba(13, 110, 253, 0.55);
}
body.dark td.cell-picked {
  background: rgba(88, 166, 255, 0.14);
  box-shadow: inset 0 0 0 2px rgba(88, 166, 255, 0.65);
}
td.cell-picked::after {
  content: "✓";
  position: absolute;
  top: 0; right: 1px;
  font-size: 9px;
  color: var(--blue);
  font-weight: 600;
  pointer-events: none;
}
td.cell-picked.hit-cell { box-shadow: inset 0 0 0 2px var(--blue); }

/* 每个视图卡片顶部的选号面板 — 醒目蓝条引导，让用户立刻明白要点表格 */
.select-panel {
  border-bottom: 1px solid var(--grid-soft);
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(13, 110, 253, 0.08), rgba(13, 110, 253, 0.02));
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
/* 空状态（未选号）完全折叠，不占空间、不显示提示横幅 */
.select-panel:empty {
  display: none;
}
body.dark .select-panel {
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.10), rgba(88, 166, 255, 0.02));
}
.select-panel.active {
  background: linear-gradient(180deg, rgba(13, 110, 253, 0.12), rgba(13, 110, 253, 0.04));
}
.select-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.select-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--grid-soft);
  border-radius: 8px;
  padding: 4px 8px;
  flex-wrap: wrap;
}
.select-slot-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-right: 2px;
}
.select-slot-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }

.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--blue);
  background: rgba(13, 110, 253, 0.10);
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.pick-chip:hover { background: rgba(13, 110, 253, 0.18); }
.pick-chip-x {
  font-size: 11px;
  opacity: 0.65;
  margin-left: 2px;
}
.pick-chip-static {
  cursor: default;
  border-color: var(--grid);
  color: var(--ink);
  background: var(--surface-2);
}
.pick-chip-static:hover { background: var(--surface-2); }

.select-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.select-summary {
  font-size: 13px;
  color: var(--ink);
}
.select-summary strong { color: var(--blue); font-family: var(--font-mono); }
.select-clear {
  background: transparent;
  border: 1px solid var(--grid);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--muted);
}
.select-clear:hover { background: var(--surface-3); color: var(--ink); }

/* 悬浮"我的选号"按钮 */
.picks-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 48px;
  border-radius: 24px;
  border: 1px solid var(--grid);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}
.picks-fab:hover { transform: translateY(-2px); }
.picks-fab.has-picks {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.picks-fab-icon { font-size: 18px; }
.picks-fab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.25);
  font-family: var(--font-mono);
  font-size: 12px;
}
.picks-fab:not(.has-picks) .picks-fab-count {
  background: var(--surface-3);
  color: var(--muted);
}

/* 全局选号弹层 */
.picks-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
}
.picks-modal.open { display: block; }
.picks-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
body.dark .picks-modal-backdrop { background: rgba(0, 0, 0, 0.6); }
.picks-modal-panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--grid);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
}
.picks-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--grid-soft);
}
.picks-modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.picks-modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  padding: 4px 8px;
}
.picks-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.picks-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--grid-soft);
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--grid);
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
}
.ghost-btn:hover { background: var(--surface-3); color: var(--ink); }
.primary-btn {
  background: var(--blue);
  border: 1px solid var(--blue);
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
}
.primary-btn:hover { opacity: 0.9; }

.mp-empty {
  color: var(--dim);
  font-size: 13px;
  text-align: center;
  padding: 36px 0;
}
.mp-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--grid-soft);
}
.mp-view:last-child { border-bottom: none; padding-bottom: 0; }
.mp-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.mp-view-head strong { color: var(--ink); font-weight: 600; }
.mp-dim { color: var(--dim); font-size: 12px; }
.mp-slots {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mp-slot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
}
.mp-slot-label {
  color: var(--muted);
  margin-right: 4px;
}
.mp-summary {
  font-size: 12px;
  color: var(--ink);
}
.mp-summary strong { color: var(--blue); font-family: var(--font-mono); }
.mp-pool { background: var(--surface-2); margin: -4px -4px 8px; padding: 10px 12px; border-radius: 8px; border-bottom: 1px solid var(--grid-soft); }
.mp-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 4px;
  margin-top: 4px;
}
.pool-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  background: var(--surface);
  border: 1px solid var(--grid-soft);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}

/* 手机端：选号面板贴底部 sticky，FAB 缩小，弹层全屏 */
@media (max-width: 768px) {
  .picks-fab {
    bottom: 12px;
    right: 12px;
    height: 44px;
    padding: 0 14px;
    font-size: 13px;
  }
  .picks-modal-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 90vh;
    border-radius: 14px 14px 0 0;
  }
  .select-panel {
    padding: 4px 8px;
    font-size: 11px;
  }
  .select-slot { padding: 2px 5px; }
  .select-slot-label { font-size: 11px; }
  .pick-chip { font-size: 11px; padding: 1px 5px 1px 6px; }
  .pool-num { font-size: 11px; }
}
@media (max-width: 420px) {
  .picks-fab span:not(.picks-fab-icon):not(.picks-fab-count) { display: none; }
  .picks-fab { padding: 0 12px; }
}

/* ─────────────────────────────────────────────────────────────
   下期条件推荐 (reco-card)
   ───────────────────────────────────────────────────────────── */
.reco-card {
  margin: 12px 0 16px;
  border: 1px solid var(--grid);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.reco-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grid-soft);
  background: var(--surface-2);
}
.reco-title { display: flex; flex-direction: column; gap: 2px; }
.reco-title strong { font-size: 15px; font-weight: 600; color: var(--ink); }
.reco-sub { font-size: 12px; color: var(--dim); }
.reco-controls { display: flex; align-items: center; gap: 8px; }
.reco-window { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.reco-window select {
  border: 1px solid var(--grid);
  background: var(--surface);
  color: var(--ink);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
}
.reco-mini-btn {
  border: 1px solid var(--grid);
  background: var(--surface);
  color: var(--ink);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
}
.reco-mini-btn:hover { border-color: var(--blue); color: var(--blue); }

.reco-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px;
  background: var(--grid-soft);
}
.reco-card.collapsed .reco-body { display: none; }

.reco-block {
  padding: 12px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reco-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.reco-block-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.reco-block-hint { font-size: 11px; color: var(--dim); }
.reco-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

.reco-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  min-width: 22px;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 7px;
  border: 1px solid var(--grid);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  line-height: 1.1;
}
.reco-chip .reco-freq { font-size: 10px; color: var(--dim); }
/* recommended (kept) — blue accent */
.reco-chip.reco-on {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}
.reco-chip.reco-on .reco-freq { color: var(--blue); opacity: 0.75; }
/* hot key digit — red accent */
.reco-chip.reco-hot {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.reco-chip.reco-hot .reco-freq { color: var(--accent); opacity: 0.75; }
/* kill / cold — dimmed + strike */
.reco-chip.reco-kill {
  border-style: dashed;
  color: var(--dim);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  opacity: 0.7;
}

.reco-range {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ink);
}
.reco-range .reco-range-core { color: var(--blue); }
.reco-pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.reco-pill {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--grid);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
}
.reco-pill .reco-freq { color: var(--dim); font-size: 10px; margin-left: 3px; }
.reco-pill.reco-on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.reco-pill.reco-on .reco-freq { color: var(--blue); opacity: 0.75; }

.reco-note { font-size: 11px; color: var(--dim); line-height: 1.5; }
.reco-pos-row { display: flex; align-items: center; gap: 8px; }
.reco-pos-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--dim);
  width: 34px;
}

/* ─────────────────────────────────────────────────────────────
   自然语言查询 (nlq-card)
   ───────────────────────────────────────────────────────────── */
.nlq-card {
  margin: 0 0 16px;
  border: 1px solid var(--grid);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nlq-title { display: flex; flex-direction: column; gap: 2px; }
.nlq-title strong { font-size: 15px; font-weight: 600; color: var(--ink); }
.nlq-sub { font-size: 12px; color: var(--dim); }
.nlq-input-row { display: flex; gap: 8px; }
.nlq-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--grid);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
}
.nlq-input:focus { outline: none; border-color: var(--blue); }
.nlq-run {
  flex: 0 0 auto;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 14px;
  cursor: pointer;
}
.nlq-run:disabled { opacity: 0.55; cursor: default; }
.nlq-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.nlq-example {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed var(--grid);
  background: var(--surface);
  color: var(--dim);
  cursor: pointer;
}
.nlq-example:hover { border-style: solid; border-color: var(--blue); color: var(--blue); }

.nlq-result { display: none; flex-direction: column; gap: 12px; }
.nlq-result.show { display: flex; }
.nlq-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--grid-soft);
}
.nlq-engine {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--grid);
  color: var(--dim);
}
.nlq-engine.rules { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.nlq-engine.llm { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.nlq-engine.none { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.nlq-cond {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--blue-soft);
  border: 1px solid var(--blue);
  color: var(--blue);
  font-family: var(--font-mono);
}
.nlq-count { font-size: 13px; color: var(--ink); }
.nlq-count strong { color: var(--accent); font-family: var(--font-mono); font-size: 15px; }
.nlq-msg { font-size: 12px; color: var(--dim); }

.nlq-stats { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px; }
.nlq-stat-group { display: flex; flex-direction: column; gap: 4px; }
.nlq-stat-label { font-size: 11px; color: var(--dim); }
.nlq-stat-val { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.nlq-stat-val .hot { color: var(--accent); }

.nlq-list-wrap { max-height: 320px; overflow-y: auto; border: 1px solid var(--grid-soft); border-radius: 8px; }
.nlq-list { width: 100%; border-collapse: collapse; font-size: 13px; }
.nlq-list th, .nlq-list td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--grid-soft); }
.nlq-list th { position: sticky; top: 0; background: var(--surface-2); color: var(--dim); font-weight: 500; font-size: 12px; }
.nlq-list td { font-family: var(--font-mono); color: var(--ink); }
.nlq-list td.nlq-code { letter-spacing: 2px; color: var(--accent); }
.nlq-list tr:last-child td { border-bottom: none; }
.nlq-more { font-size: 11px; color: var(--dim); text-align: center; padding: 8px; }

/* 自然语言查询 — 枚举/缺失结果网格 */
.nlq-miss-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}
.nlq-miss {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1px;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--grid);
  background: var(--surface-2);
  color: var(--ink);
}

/* ══════════════════════════════════════════════════════════════════
   组选分析（zxfx）降噪
   ------------------------------------------------------------------
   问题：这一屏同时有 6 种满饱和色在抢眼——三色号码球 ×20 列、组选分布
   金/蓝/红、升降序 4 色、形态指标 5 色，再叠上分区底色和 3px 双线分隔，
   加上每颗球自带高光渐变 + 三层阴影 + 文字投影。信息密度没变，但视觉
   高频细节和色度对比拉满，久看很累。

   思路是「只降噪、不减信息」：
     · 位置三色在组选里本就不表意（见 renderZxfxBody 注释）→ 收成一种色
     · 延伸区是中间组选号码区的重复投影 → 压成弱对比，让视线锚在中间
     · 球去掉高光/阴影/文字投影，改平涂
     · 形态类标签从满饱和实心球改成淡底深字的色片
     · 分区线由彩色 2-3px 收成中性 1px
   命中/遗漏/分区边界全部照旧可辨，只是不再互相喊。
   ══════════════════════════════════════════════════════════════════ */

/* 1) 球平涂：去高光渐变、去三层阴影、去文字投影 */
#zxfx-table .hit-badge {
  background-image: none;
  box-shadow: none;
  text-shadow: none;
  font-weight: 500;
}

/* 2) 组选号码：统一单色（原本按百/十/个上三色，在本视图不表意） */
#zxfx-table .zxfx-any-badge { --ball: #b0473a; background: #b0473a; color: #fff; }

/* 3) 左/右延伸：它是中间区的重复投影，压成淡底深字，别跟主区抢 */
#zxfx-table .zxfx-ext-cell .zxfx-any-badge {
  background: rgba(176, 71, 58, 0.13);
  color: #9a3f33;
}

/* 4) 组选分布 / 升降序 / 形态指标：实心满饱和球 → 淡底深字色片。
      同一语义沿用同一色（组三=琥珀 组六=靛 豹子=砖红 …），认色成本不变。
      选择器要跟上面 .xxx-N-cell .hit-badge 同形，否则专一度不够压不住。 */
#zxfx-table .zxfx-dist-cell .hit-badge,
#zxfx-table .zxfx-shape-cell .hit-badge,
#zxfx-table .zxfx-gd-cell .hit-badge {
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  font-weight: 500;
}
/* 组三 琥珀 */
#zxfx-table .zxfx-dist-0-cell .hit-badge,
#zxfx-table .zxfx-gd-1-cell .hit-badge   { background: rgba(166, 108, 0, 0.15);  color: #8a5a00; }
/* 组六 靛 */
#zxfx-table .zxfx-dist-1-cell .hit-badge,
#zxfx-table .zxfx-gd-3-cell .hit-badge   { background: rgba(30, 90, 170, 0.15);  color: #1d5199; }
/* 豹子 砖红 */
#zxfx-table .zxfx-dist-2-cell .hit-badge,
#zxfx-table .zxfx-gd-0-cell .hit-badge,
#zxfx-table .zxfx-shape-0-cell .hit-badge { background: rgba(176, 71, 58, 0.16); color: #9a3f33; }
/* 下山 / 杂六 绿 */
#zxfx-table .zxfx-shape-1-cell .hit-badge,
#zxfx-table .zxfx-gd-4-cell .hit-badge   { background: rgba(42, 122, 74, 0.15);  color: #246941; }
/* 凹 琥珀 */
#zxfx-table .zxfx-shape-2-cell .hit-badge { background: rgba(166, 108, 0, 0.15); color: #8a5a00; }
/* 凸 / 全顺 紫 */
#zxfx-table .zxfx-shape-3-cell .hit-badge,
#zxfx-table .zxfx-gd-2-cell .hit-badge   { background: rgba(104, 71, 168, 0.15); color: #5b3f93; }
/* 平 中性 */
#zxfx-table .zxfx-shape-4-cell .hit-badge { background: rgba(100, 116, 139, 0.16); color: #55606f; }

/* 5) 数值指标（和值/和尾/跨度）：去掉蓝底方块，留深色数字即可 */
#zxfx-table .sum-badge {
  background: none;
  box-shadow: none;
  color: var(--ink);
  font-weight: 500;
}

/* 6) 分区线：彩色 2-3px → 中性 1px。选择器沿用原有的（列号规则改过一次，
      别动），只换颜色粗细。
      注意两处「双线」来源，都要治：
        a. 原来用的是 border-style: double —— 这个关键字本身就画两条线；
        b. 表格是 border-collapse: separate，每个格子自己画右边框，所以在
           分界处「前一格的右边框 + 分界格的左边框」必然并排出两条。
      对策：分界格画 1px 左边框，同时把它前面那一格的右边框抹掉，净得一条。
      ⚠ 列号写死在这里，加/减一列就必须跟着挪。升降序补回「平」那次（4→5 列）
      忘了改，30/33 就从「数值指标 / 形态指标」的分界滑进了升降序内部，
      在 凸 和 平 中间多画了一条竖线。
      现在的分界列 = 8/18/23/26/31/34，对应要抹右边框的是 7/17/22/25/30/33。 */
#zxfx-table td:nth-child(8),  #zxfx-table th:nth-child(8),
#zxfx-table td:nth-child(18), #zxfx-table th:nth-child(18),
#zxfx-table td:nth-child(23), #zxfx-table th:nth-child(23),
#zxfx-table td:nth-child(26), #zxfx-table th:nth-child(26),
#zxfx-table td:nth-child(31), #zxfx-table th:nth-child(31),
#zxfx-table td:nth-child(34), #zxfx-table th:nth-child(34),
#zxfx-table thead tr:nth-child(1) th:nth-child(4),
#zxfx-table thead tr:nth-child(1) th:nth-child(5),
#zxfx-table thead tr:nth-child(1) th:nth-child(6),
#zxfx-table thead tr:nth-child(2) th:nth-child(1),
#zxfx-table thead tr:nth-child(2) th:nth-child(2),
#zxfx-table thead tr:nth-child(2) th:nth-child(3),
#zxfx-table thead tr:nth-child(2) th:nth-child(4),
#zxfx-table thead tr:nth-child(2) th:nth-child(5),
#zxfx-table thead tr:nth-child(2) th:nth-child(6),
#zxfx-table thead tr:nth-child(2) th:nth-child(7) {
  border-left: 1px solid rgba(100, 116, 139, 0.45) !important;
}
/* 分界列前一格的右边框抹掉，避免与上面的左边框并排成双线 */
#zxfx-table td:nth-child(7),  #zxfx-table th:nth-child(7),
#zxfx-table td:nth-child(17), #zxfx-table th:nth-child(17),
#zxfx-table td:nth-child(22), #zxfx-table th:nth-child(22),
#zxfx-table td:nth-child(25), #zxfx-table th:nth-child(25),
#zxfx-table td:nth-child(30), #zxfx-table th:nth-child(30),
#zxfx-table td:nth-child(33), #zxfx-table th:nth-child(33) {
  border-right: 0 !important;
}

/* 7) 遗漏数字压淡一档 —— 它是背景信息，不该跟命中同重量 */
#zxfx-table td.omit { color: var(--dim); }

/* 深色主题：淡底色片在暗背景上要反过来提亮文字 */
body.dark #zxfx-table .zxfx-ext-cell .hit-badge.zxfx-any-badge { background: rgba(200, 110, 95, 0.18); color: #d98d7d; }
body.dark #zxfx-table .zxfx-dist-0-cell .hit-badge,
body.dark #zxfx-table .zxfx-gd-1-cell .hit-badge,
body.dark #zxfx-table .zxfx-shape-2-cell .hit-badge { background: rgba(200, 145, 40, 0.18); color: #d9a441; }
body.dark #zxfx-table .zxfx-dist-1-cell .hit-badge,
body.dark #zxfx-table .zxfx-gd-3-cell .hit-badge   { background: rgba(80, 145, 230, 0.18); color: #6fa8e8; }
body.dark #zxfx-table .zxfx-dist-2-cell .hit-badge,
body.dark #zxfx-table .zxfx-gd-0-cell .hit-badge,
body.dark #zxfx-table .zxfx-shape-0-cell .hit-badge { background: rgba(200, 110, 95, 0.18); color: #d98d7d; }
body.dark #zxfx-table .zxfx-shape-1-cell .hit-badge,
body.dark #zxfx-table .zxfx-gd-4-cell .hit-badge   { background: rgba(70, 170, 110, 0.18); color: #56b483; }
body.dark #zxfx-table .zxfx-shape-3-cell .hit-badge,
body.dark #zxfx-table .zxfx-gd-2-cell .hit-badge   { background: rgba(150, 115, 220, 0.18); color: #a688e0; }
body.dark #zxfx-table .zxfx-shape-4-cell .hit-badge { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }

/* ── 双色球基本走势 (ssq) ──────────────────────────────────
   59 列：期号(⇄日期) | 奖号 | 红球 33(三区) | 指标 8 | 蓝球 16(两区)

   两个必须守住的点：
   1) 分区底色只能加在 td 上。表头是 position: sticky 的，给它半透明底色会
      让滚到下面的数据行透上来（表现为表头文字有重影）——th 必须保持不透明。
   2) 列宽写死。指标区标签是「大小比 / 奇偶比 / 质合比 / 012路 / 大中小」，
      按默认宽度会被挤到互相重叠。 */
.ssq-table th,
.ssq-table td { white-space: nowrap; }

/* 列宽 —— 红蓝球格窄、指标区宽、奖号列要装下 6 红 + 1 蓝 */
.ssq-table .ssq-red-head, .ssq-table .ssq-red-cell,
.ssq-table .ssq-blue-head, .ssq-table .ssq-blue-cell {
  width: 32px; min-width: 32px; max-width: 32px;
}
.ssq-table .ssq-kpi-head, .ssq-table .ssq-kpi-cell {
  width: 48px; min-width: 48px; max-width: 48px;
}
/* 奖号列宽按彩种给：双色球 6 红+1 蓝要 140px，排列五 5 个一位数 56px 就够。
   用变量而不是每个彩种一条规则，加彩种时只改 --open-w。 */
.ssq-table { --open-w: 140px; }
/* !important 保留着：上面那条 110px 的规则现在已经关进 #trend-table，
   但列宽在自动布局下取该列各单元格约束的最大值，这里用 important 把三个
   维度都钉死，加彩种时只要改 --open-w 就一定生效，不必再排查是谁在抢。 */
.ssq-table .ssq-open-head, .ssq-table .ssq-open-cell {
  width: var(--open-w) !important;
  min-width: var(--open-w) !important;
  max-width: var(--open-w) !important;
}

/* 列少的表（如排列五大小走势只有 18 列）不要撑满容器。
   table 默认 width: max-content + min-width: 100%，余宽在自动布局下会全部
   压给某一列 —— 实测奖号列被撑到 319px，而它本该只有 56px。这里让这类表
   按内容宽度排布，宽表不受影响（它们本来就超出容器，min-width 不起作用）。 */
.ssq-table.ssq-fit { min-width: 0; }

/* 分区底色（仅正文）—— 同色系明暗交替，11 列一组一眼分得开。
   饱和度压到最低：这是分区提示，不是强调。 */
.ssq-table td.ssq-rz-0 { background: rgba(192, 57, 43, 0.035); }
.ssq-table td.ssq-rz-1 { background: rgba(192, 57, 43, 0.075); }
.ssq-table td.ssq-rz-2 { background: rgba(192, 57, 43, 0.035); }
.ssq-table td.ssq-bz-0 { background: rgba(88, 166, 255, 0.05); }
.ssq-table td.ssq-bz-1 { background: rgba(88, 166, 255, 0.09); }
.ssq-table td.ssq-kpi-cell { background: rgba(100, 116, 139, 0.05); }

/* 区首竖线。border-collapse: separate 下前一格的右边框会和这条左边框并成
   两根，所以顺带把前一格的右边框去掉（同 zxfx 的处理）。 */
.ssq-table .zone-start.ssq-rz-0,
.ssq-table .zone-start.ssq-rz-1,
.ssq-table .zone-start.ssq-rz-2 { border-left: 2px solid rgba(192, 57, 43, 0.45) !important; }
.ssq-table .zone-start.ssq-bz-0,
.ssq-table .zone-start.ssq-bz-1 { border-left: 2px solid rgba(88, 166, 255, 0.45) !important; }
.ssq-table .ssq-kpi-head.zone-start,
.ssq-table .ssq-kpi-cell.zone-start { border-left: 2px solid rgba(100, 116, 139, 0.4) !important; }

/* 指标区数值：等宽体，比值类 (3:3 / 2:2:2) 才能对齐扫读 */
.ssq-table .ssq-kpi-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  text-align: center;
}

/* 奖号列：6 红 + 1 蓝并排 */
.ssq-table .ssq-open-cell { padding: 0 4px; text-align: center; }
/* 快乐8 每期 20 个两位数，一行装不下 —— 这一列（也只有这一列）允许折行。
   三件事缺一不可：
   1) 解开 .ssq-table td 的 nowrap；
   2) 每个号码变成 inline-block，它就是一个不可再分的原子，不会从中间断开；
   3) overflow-wrap: anywhere —— 号码之间没有空格，"0607…" 在浏览器眼里是
      一个长单词，不给这条就一个断点都找不到，只会溢出而不折行。
   行高由内容撑开，冻结首列的克隆是按实测行高建的，会跟着变。 */
.ssq-table.ssq-open-wrap .ssq-open-head,
.ssq-table.ssq-open-wrap .ssq-open-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  /* 两行必须塞进 th,td 的 32px 里：13px 行高 ×2 + 2px 上下内边距 = 30px。
     松一点（1.4 行高 + 3px 内边距 = 38px）会把行撑高，而行高是整张表共用的
     —— 一列的排版需求就把右边 80 列的格子全拉成竖长方形了，不划算。 */
  line-height: 13px;
  padding: 2px 4px;
}
.ssq-table.ssq-open-wrap .ssq-open-cell i {
  display: inline-block;
  white-space: nowrap;
}
/* 手机上整张表的行高是 26px（见 <=768px 那段），两行得再收一档才不撑行；
   顺带把列宽从 184 收到 150，小屏上能多露出两三列号码。 */
@media (max-width: 768px) {
  .ssq-table.ssq-open-wrap { --open-w: 150px !important; }
  .ssq-table.ssq-open-wrap .ssq-open-head,
  .ssq-table.ssq-open-wrap .ssq-open-cell {
    line-height: 11px;
    padding: 1px 3px;
  }
  .ssq-table.ssq-open-wrap .ssq-open-cell i { font-size: 10px; padding: 0 1px; }
}
.ssq-table .ssq-open-cell i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 1px;
}
.ssq-table .ssq-open-red { color: var(--accent); }
.ssq-table .ssq-open-blue { color: var(--blue); font-weight: 600; margin-left: 3px; }

/* 表头分区标题用色分别对应红/蓝球 */
.ssq-table .ssq-red-title, .ssq-table .ssq-red-sub { color: var(--accent); }
.ssq-table .ssq-blue-title, .ssq-table .ssq-blue-sub { color: var(--blue); }

/* 深色主题：底色改为提亮，否则在深底上分区看不出来 */
body.dark .ssq-table td.ssq-rz-0 { background: rgba(192, 57, 43, 0.07); }
body.dark .ssq-table td.ssq-rz-1 { background: rgba(192, 57, 43, 0.14); }
body.dark .ssq-table td.ssq-rz-2 { background: rgba(192, 57, 43, 0.07); }
body.dark .ssq-table td.ssq-bz-0 { background: rgba(88, 166, 255, 0.09); }
body.dark .ssq-table td.ssq-bz-1 { background: rgba(88, 166, 255, 0.16); }
body.dark .ssq-table td.ssq-kpi-cell { background: rgba(148, 163, 184, 0.09); }

/* ── 双色球定位走势 (ssqp1..ssqp6) ─────────────────────────
   跟基本走势共用 .ssq-table 的基础（不透明表头、等宽数值、奖号列），
   这里只补分组的冷暖交替底色：相邻分组一红一蓝，8 个组一眼能分开。 */
.ssq-pos-table .ssq-pg-red-cell  { background: rgba(192, 57, 43, 0.04); }
.ssq-pos-table .ssq-pg-blue-cell { background: rgba(88, 166, 255, 0.05); }
/* 表头必须不透明 —— 它是 sticky 的，半透明会让滚到下面的数据行透上来 */
.ssq-pos-table th.ssq-pg-red-cell,
.ssq-pos-table th.ssq-pg-blue-cell { background: var(--surface-2); }

.ssq-pos-table .ssq-pg-title.ssq-pg-red  { color: var(--accent); }
.ssq-pos-table .ssq-pg-title.ssq-pg-blue { color: var(--blue); }

/* 组首竖线，冷暖对应 */
.ssq-pos-table .zone-start.ssq-pg-red-cell  { border-left: 2px solid rgba(192, 57, 43, 0.45) !important; }
.ssq-pos-table .zone-start.ssq-pg-blue-cell { border-left: 2px solid rgba(88, 166, 255, 0.45) !important; }

/* 列宽：号码/振幅这类数字列窄，大小·奇偶·质合·升平降是汉字标签，要略宽 */
.ssq-pos-table .ssq-pg-head, .ssq-pos-table td.ssq-pg-red-cell,
.ssq-pos-table td.ssq-pg-blue-cell { width: 32px; min-width: 32px; max-width: 32px; }

/* 奖号列里当前这一位加粗标出，方便对照 */
.ssq-table .ssq-open-cur {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.dark .ssq-pos-table .ssq-pg-red-cell  { background: rgba(192, 57, 43, 0.09); }
body.dark .ssq-pos-table .ssq-pg-blue-cell { background: rgba(88, 166, 255, 0.10); }
body.dark .ssq-pos-table th.ssq-pg-red-cell,
body.dark .ssq-pos-table th.ssq-pg-blue-cell { background: var(--surface-2); }


/* 期号列必须写死宽度。table 是 width: max-content + min-width: 100%，列少的表
   （和值走势只有 13 列）余宽会全被 auto 宽度的期号列吃掉，撑到 1200px。
   钉住之后余宽按各列指定宽度比例分摊，看起来才是「铺满」而不是「畸形」。 */
.ssq-table .issue-head,
.ssq-table .issue-cell { width: 92px; min-width: 92px; }

/* 区间写法的段标签（「101-110」）比两位号码宽一倍多，32px 会截断 */
.ssq-table .pg-wide { width: 58px; min-width: 58px; max-width: 58px; }

/* ════════════════════════════════════════════════════════════
   画图标注 (draw annotations)
   用户按自己的经验在走势图上画横线/竖线/斜线/方框。
   坐标以「占表格宽高的比例」存储（见 app.js 的 normalize/denormalize），
   所以换期数、系统字体放大、转屏都不会让标注跑位。
   ──────────────────────────────────────────────────────────── */
/* 选择器必须带 .controls：控制条里有一条 `.controls button { background: var(--accent) }`
   (0,1,1)，单写 .draw-toggle (0,1,0) 会被它盖成红底白字 —— 未按下时就是一颗红按钮。 */
.controls .draw-toggle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}
.controls .draw-toggle:hover { color: var(--ink); opacity: 1; }
.controls .draw-toggle[aria-pressed="true"] {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-soft);
}

.draw-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--grid);
  border-radius: 10px;
  background: var(--surface-2);
}
.draw-bar[hidden] { display: none; }
.draw-tools, .draw-colors, .draw-widths, .draw-acts { display: flex; align-items: center; gap: 6px; }

/* 粗细：按钮里就是一段该粗细的横杠，比写「细/中/粗」直观 */
.draw-width {
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--grid);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.draw-width i { display: block; width: 16px; border-radius: 3px; background: var(--muted); }
.draw-width.active { border-color: var(--blue); }
.draw-width.active i { background: var(--blue); }
.draw-acts { margin-left: auto; }

.draw-tool, .draw-act {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--grid);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
}
.draw-tool:hover, .draw-act:hover { border-color: var(--blue); }
.draw-tool.active {
  color: #fff;
  border-color: transparent;
  background: var(--blue);
}
.draw-exit { color: var(--muted); }
.draw-act:disabled { cursor: wait; opacity: 0.6; }
/* 「清空本图」点第一下后的待确认状态 */
.draw-act.draw-danger { color: #c0392b; border-color: #c0392b; }

/* 截图的进度 / 结果提示：页面底部浮一行字，几秒后消失 */
.shot-notice {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}
.shot-notice[hidden] { display: none; }

.draw-color {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--grid);
  border-radius: 50%;
  background: var(--sw);
  cursor: pointer;
}
.draw-color.active { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 3px var(--sw); }

.draw-count { font-size: 12px; color: var(--muted); }

/* 标注层 —— 盖在折线和球之上（球是 z-index:2，折线 1） */
.draw-layer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}
.draw-layer.draw-on { pointer-events: auto; cursor: crosshair; }
.draw-layer.draw-erase { cursor: pointer; }
.draw-shape {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
}
.draw-shape.draw-preview { stroke-dasharray: 5 4; opacity: 0.8; }

/* 画图时表格不能跟着手指滑走，否则一笔下去就变成了翻页 */
.table-wrap.draw-active { touch-action: none; }

@media (max-width: 768px) {
  .draw-bar { gap: 6px 10px; padding: 6px 8px; border-radius: 8px; }
  .draw-tool, .draw-act { min-height: 30px; padding: 0 9px; font-size: 12px; }
  .draw-acts { margin-left: 0; width: 100%; }
  .draw-count { margin-left: auto; }
}

/* 组选分析的折线：发丝级。这张表是压淡过的（淡底深字色片），线只做「串起来」
   这一件事，不许比数据抢眼。颜色写在 CSS 而不是 app.js，才能跟着深浅色主题走
   —— 浅色下的中性灰在 #0d1117 上几乎看不见。 */
#zxfx-wrap .trend-path.zxfx-path {
  stroke: rgba(100, 116, 139, 0.32);
  stroke-width: 1;
  stroke-linejoin: round;
  stroke-linecap: round;
}
body.dark #zxfx-wrap .trend-path.zxfx-path { stroke: rgba(148, 163, 184, 0.34); }

/* ════════════════════════════════════════════════════════════
   表格背景皮肤 (data-skin on <body>)
   经典彩色 = 原样不动；其余四套把「表格的底色 / 表头 / 格线」统一换掉，
   球、折线、遗漏数字、页脚统计这些数据本身一概不碰。
   ──────────────────────────────────────────────────────────── */

/* 每套皮肤只定义这几个变量，下面一组规则统一消费 */
body[data-skin="plain"] { --skin-cell: #ffffff; --skin-alt: #ffffff; --skin-head: #f7f8fa; --skin-line: #e8ecf1; --skin-hover: #eef4ff; }
body[data-skin="zebra"] { --skin-cell: #ffffff; --skin-alt: #f3f5f8; --skin-head: #eef1f5; --skin-line: #e3e8ef; --skin-hover: #e6efff; }
body[data-skin="paper"] { --skin-cell: #fbf7ec; --skin-alt: #f7f1e2; --skin-head: #f1e8d3; --skin-line: #e6dcc5; --skin-hover: #f3e7c9; }
body[data-skin="grid"]  { --skin-cell: #ffffff; --skin-alt: #ffffff; --skin-head: #f4f6f9; --skin-line: #cdd5e1; --skin-hover: #eef4ff; }

body.dark[data-skin="plain"] { --skin-cell: #161b22; --skin-alt: #161b22; --skin-head: #1b212b; --skin-line: #242b35; --skin-hover: #1d2736; }
body.dark[data-skin="zebra"] { --skin-cell: #161b22; --skin-alt: #1c222c; --skin-head: #1f2631; --skin-line: #262e39; --skin-hover: #213046; }
body.dark[data-skin="paper"] { --skin-cell: #1c1a15; --skin-alt: #211e18; --skin-head: #28241c; --skin-line: #36312a; --skin-hover: #2e2a20; }
body.dark[data-skin="grid"]  { --skin-cell: #12171e; --skin-alt: #12171e; --skin-head: #1a2029; --skin-line: #38424f; --skin-hover: #1d2736; }

/* 正文格子。
   · !important 是必须的：分区着色分散在二百多条规则里，不少带 #id，
     权重打不过；而且皮肤本来就是要盖过它们。
   · 预测行 / 添加行 / 冻结列里透明的占位格（frozen-hole）都跳过 ——
     前两个有自己的语义底色，占位格必须保持透明才能露出下层真实行。
   · 冻结首列的克隆也在 .table-wrap 里，同一条规则一起生效，颜色天然对齐。 */
body[data-skin]:not([data-skin="classic"]) .table-wrap tbody > tr:not(.sel-row):not(.sel-add-row) > td:not(.frozen-hole) {
  background: var(--skin-cell) !important;
  border-right-color: var(--skin-line);
  border-bottom-color: var(--skin-line);
}
body[data-skin]:not([data-skin="classic"]) .table-wrap tbody > tr:not(.sel-row):not(.sel-add-row):nth-child(even) > td:not(.frozen-hole) {
  background: var(--skin-alt) !important;
}
/* 悬停高亮：原版用的是半透明蓝，冻结列会透出下层；这里给不透明色 */
body[data-skin]:not([data-skin="classic"]) .table-wrap tbody > tr:not(.sel-row):not(.sel-add-row):hover > td:not(.frozen-hole) {
  background: var(--skin-hover) !important;
}

/* 分区竖线：彩色 2px 线是「花」的主要来源之一，换成中性色，粗细不动（仍然分得清区）。
   这些竖线散在各表按 #id + nth-child 写的规则里，权重很高还带 !important。
   :is(td, th, #\#) 借一个永远匹配不到的 id 把本规则权重抬到 (1,x,x)，
   才压得住 —— 真正参与匹配的只有 td/th。 */
body[data-skin]:not([data-skin="classic"]) .table-wrap :is(td, th, #\#) {
  border-left-color: var(--skin-divider) !important;
}
body[data-skin="plain"], body[data-skin="zebra"] { --skin-divider: #c3ccd8; }
body[data-skin="paper"] { --skin-divider: #cfc1a0; }
body[data-skin="grid"]  { --skin-divider: #8e9bad; }
body.dark[data-skin="plain"], body.dark[data-skin="zebra"] { --skin-divider: #3a4452; }
body.dark[data-skin="paper"] { --skin-divider: #4a4232; }
body.dark[data-skin="grid"]  { --skin-divider: #5a6778; }

/* 表头：去掉分区底色，保留分区标题的文字颜色（认区靠字色就够了）。
   表头是 sticky 的，底色必须不透明，否则滚动时会透出数据行。 */
body[data-skin]:not([data-skin="classic"]) .table-wrap thead th {
  background: var(--skin-head) !important;
  border-right-color: var(--skin-line);
  border-bottom-color: var(--skin-line);
}

/* ── 选择面板 ─────────────────────────────────────────────── */
.controls .skin-toggle[aria-expanded="true"] {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-soft);
}
.skin-pop {
  position: fixed;
  z-index: 90; /* 要压过右下角的选号悬浮按钮 (.picks-fab 是 80)，手机上面板贴底会跟它重叠 */
  width: 272px;
  padding: 10px;
  border: 1px solid var(--grid);
  border-radius: 12px;
  background: var(--surface);
}
.skin-pop[hidden] { display: none; }
.skin-pop-head { font-size: 12px; color: var(--muted); padding: 0 4px 8px; }
.skin-list { display: grid; gap: 4px; }
.skin-opt {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  width: 100%;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.skin-opt:hover { background: var(--surface-2); }
.skin-opt[aria-checked="true"] { border-color: var(--blue); background: var(--blue-soft); }
.skin-name { font-size: 13px; font-weight: 500; }
.skin-note { grid-column: 2; font-size: 12px; color: var(--muted); }
.skin-swatch {
  grid-row: 1 / span 2;
  width: 44px;
  height: 32px;
  border: 1px solid var(--grid);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
/* 小样：每套皮肤画一个 4×3 的迷你表格 + 一颗球，一眼看出区别 */
.skin-swatch::after {
  content: "";
  position: absolute;
  left: 15px; top: 11px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #c0392b;
}
.skin-opt[data-skin="classic"] .skin-swatch {
  background:
    linear-gradient(90deg, rgba(192,57,43,.14) 0 33%, rgba(13,110,253,.12) 33% 66%, rgba(31,157,85,.12) 66%),
    #fff;
}
.skin-opt[data-skin="plain"] .skin-swatch {
  background:
    repeating-linear-gradient(90deg, transparent 0 10px, #e8ecf1 10px 11px),
    repeating-linear-gradient(0deg, transparent 0 10px, #e8ecf1 10px 11px),
    #fff;
}
.skin-opt[data-skin="zebra"] .skin-swatch {
  background: repeating-linear-gradient(0deg, #fff 0 8px, #eef1f5 8px 16px);
}
.skin-opt[data-skin="paper"] .skin-swatch {
  background:
    repeating-linear-gradient(90deg, transparent 0 10px, #e6dcc5 10px 11px),
    repeating-linear-gradient(0deg, transparent 0 10px, #e6dcc5 10px 11px),
    #fbf7ec;
}
.skin-opt[data-skin="grid"] .skin-swatch {
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, #b9c3d1 7px 8px),
    repeating-linear-gradient(0deg, transparent 0 7px, #b9c3d1 7px 8px),
    #fff;
}

@media (max-width: 768px) {
  /* 手机上做成贴底的面板，手指好点，也不挡住表格上半部分 */
  .skin-pop {
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: 8px;
    width: auto;
  }
  .skin-list { grid-template-columns: 1fr 1fr; }
  .skin-opt { grid-template-columns: 36px 1fr; column-gap: 8px; }
  .skin-swatch { width: 36px; height: 28px; }
  .skin-swatch::after { left: 12px; top: 9px; }
  .skin-note { display: none; }
}

/* ════════════════════════════════════════════════════════════
   小球样式 (data-ball on <body>)
   经典立体 = 原样；另外四种只换「画法」，不换颜色含义 —— 百位仍是红、十位
   仍是蓝……认色习惯不变，只是没那么刺眼。颜色来自每颗球的 --ball。
   ──────────────────────────────────────────────────────────── */

/* 组选分析右侧的形态色片和左/右延伸的淡色球本来就是淡底深字，已经够柔和，
   不参与；其余所有球都走下面这组规则。 */
body[data-ball]:not([data-ball="classic"]) .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
  text-shadow: none !important;
}

/* 扁平：去掉高光和阴影，纯色平涂 */
body[data-ball="flat"] .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
  background: var(--ball) !important;
  box-shadow: none !important;
}

/* 空心描边：只留一圈颜色，数字用同色 —— 视觉重量最轻 */
body[data-ball="ring"] .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
  background: var(--surface) !important;
  box-shadow: inset 0 0 0 1.5px var(--ball) !important;
  color: var(--ball) !important;
}

/* 柔和 / 淡底要用 color-mix。放在 @supports 里：不支持的旧浏览器整段跳过、
   保持经典样式；如果直接写，含 var() 的声明会在计算期失效变成透明球。 */
@supports (background: color-mix(in srgb, red 50%, blue)) {
  /* 柔和：往灰里调一点，饱和度降下来，仍是实心白字 */
  body[data-ball="soft"] .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
    background: color-mix(in srgb, var(--ball) 62%, #9aa3ae) !important;
    box-shadow: none !important;
  }
  body.dark[data-ball="soft"] .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
    background: color-mix(in srgb, var(--ball) 58%, #4b5563) !important;
  }
  /* 淡底深字：浅色底 + 同色系深字，跟组选分析的色片同一路数 */
  body[data-ball="tint"] .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
    background: color-mix(in srgb, var(--ball) 17%, var(--surface)) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ball) 28%, transparent) !important;
    color: color-mix(in srgb, var(--ball) 78%, #000) !important;
  }
  body.dark[data-ball="tint"] .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
    background: color-mix(in srgb, var(--ball) 24%, var(--surface)) !important;
    color: color-mix(in srgb, var(--ball) 80%, #fff) !important;
  }
}

/* 面板里的分组标题 + 小球样式的小样 */
.skin-pop-head + .skin-list + .skin-pop-head { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--grid-soft); }
.ball-swatch {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 32px;
}
.ball-swatch i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font: 600 11px/1 var(--font-mono);
  font-style: normal;
  color: #fff;
}
.skin-opt[data-ball="classic"] .ball-swatch i {
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.55), rgba(255,255,255,0) 60%), #c0392b;
  box-shadow: 0 2px 4px rgba(0,0,0,.18), inset 0 -2px 3px rgba(0,0,0,.18);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.skin-opt[data-ball="flat"] .ball-swatch i { background: #c0392b; }
.skin-opt[data-ball="soft"] .ball-swatch i { background: #b3786f; }
.skin-opt[data-ball="tint"] .ball-swatch i { background: #f5e0dd; color: #962d22; box-shadow: inset 0 0 0 1px rgba(192,57,43,.28); }
.skin-opt[data-ball="ring"] .ball-swatch i { background: var(--surface); color: #c0392b; box-shadow: inset 0 0 0 1.5px #c0392b; }

@media (max-width: 768px) {
  .ball-swatch { width: 36px; height: 28px; }
  .ball-swatch i { width: 18px; height: 18px; font-size: 10px; }
  /* 两组选项放一起，面板会变高，允许内部滚动 */
  .skin-pop { max-height: 70vh; overflow-y: auto; }
}

/* 球变柔和之后，满饱和的折线会反过来成为最抢眼的东西 —— 跟着降一档。
   经典 / 扁平的球本身够重，折线保持原样。 */
body[data-ball="soft"] .trend-path,
body[data-ball="tint"] .trend-path,
body[data-ball="ring"] .trend-path { opacity: 0.6; }

/* ════════════════════════════════════════════════════════════
   文字按钮（风格 / 画图）
   原来是格子图标和笔尖图标，很多人看不懂是干什么的，直接写字。
   ──────────────────────────────────────────────────────────── */
.controls .draw-toggle.text-toggle {
  width: auto;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
@media (max-width: 768px) {
  .controls .draw-toggle.text-toggle { padding: 0 9px; font-size: 13px; min-height: 36px; }
}

/* ════════════════════════════════════════════════════════════
   彩票店手绘走势图
   照着彩票店墙上那种手画的走势纸来：米白纸面、浅蓝印刷格、每五期一条
   粗线、手写数字、马克笔画圈、手画连线。老彩民几十年看这个，换个样子
   就找不到感觉，所以尽量还原。
   · 手绘纸（data-skin="hand"）：纸面 + 格子 + 手写字
   · 马克笔圈（data-ball="hand"）：圈号 + 手画连线（抖动在 app.js 里生成）
   两者可以单独混搭，面板顶部的「彩票店手绘走势图」一键同时套上。
   ──────────────────────────────────────────────────────────── */

/* 手写数字字体。自带而不走 Google Fonts —— 国内访问不稳定。
   Patrick Hand：正体、笔画清楚，老年人也认得出；OFL 授权，见 vendor/PatrickHand-OFL.txt。
   它没有中文字形，中文回退到系统楷体，也是手写的味道。 */
@font-face {
  font-family: "Patrick Hand";
  src: url("/vendor/patrick-hand.woff2") format("woff2");
  font-display: swap;
}

body[data-skin="hand"] {
  --skin-cell: #fffdf6; --skin-alt: #fffdf6; --skin-head: #fbf6e8;
  --skin-line: #cfdaea; --skin-hover: #fff3cf; --skin-divider: #7f95b8;
  --hand-ink: #22314b; --hand-pencil: #858b95; --hand-rule5: #93a8c8;
}
/* 深色主题下是一块黑板：墨绿底、粉笔白字、粉笔格线 */
body.dark[data-skin="hand"] {
  --skin-cell: #1f2b25; --skin-alt: #1f2b25; --skin-head: #25332c;
  --skin-line: #34443b; --skin-hover: #2b3b32; --skin-divider: #6d8377;
  --hand-ink: #eef2ea; --hand-pencil: #98a79d; --hand-rule5: #5f766a;
}

/* 手写字：表格里所有字。font-size-adjust 把手写体的小 x 高度拉到跟原来的
   等宽体差不多大，格子尺寸就不用动（不支持的浏览器只是字略小一点）。 */
body[data-skin="hand"] .table-wrap :is(td, th, #\#) {
  font-family: "Patrick Hand", "Kaiti SC", "STKaiti", "KaiTi", "楷体", cursive !important;
  font-size-adjust: 0.5;
}
body[data-skin="hand"] .table-wrap tbody td { color: var(--hand-ink); }
/* 遗漏数字像铅笔写的，浅一点 —— 主角是圈起来的号 */
body[data-skin="hand"] .table-wrap tbody td.omit { color: var(--hand-pencil) !important; }
/* 每五期一条粗线，彩票店的纸上都是这么印的，数期数方便 */
body[data-skin="hand"] .table-wrap tbody > tr:not(.sel-row):not(.sel-add-row):nth-child(5n) > td:not(.frozen-hole) {
  border-bottom: 1px solid var(--hand-rule5) !important;
}

/* 马克笔圈：空心、边缘不规则、字是手写的同色字。
   底色填纸色而不是透明 —— 否则连线会从圈里穿过去压住数字。 */
body[data-ball="hand"] .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge):not(.zxfx-ext-cell .hit-badge) {
  box-sizing: border-box;
  background: var(--skin-cell, var(--surface)) !important;
  border: 2px solid var(--ball);
  box-shadow: none !important;
  text-shadow: none !important;
  color: var(--ball) !important;
  font-family: "Patrick Hand", "Kaiti SC", "STKaiti", "KaiTi", cursive !important;
  font-size-adjust: 0.5;
  border-radius: 47% 53% 44% 56% / 55% 45% 56% 44%;
}
/* 每个圈的形状和角度都略有不同，才像一个一个手画的，而不是盖的章 */
body[data-ball="hand"] td:nth-child(3n) > .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge) {
  border-radius: 55% 45% 52% 48% / 46% 56% 44% 54%;
  transform: translate(-50%, -50%) rotate(-7deg);
}
body[data-ball="hand"] td:nth-child(3n+1) > .hit-badge:not(.zxfx-dist-badge):not(.zxfx-shape-badge):not(.zxfx-gd-badge) {
  border-radius: 44% 56% 50% 50% / 52% 48% 57% 43%;
  transform: translate(-50%, -50%) rotate(5deg);
}
/* 连线：马克笔的粗细和圆头；路径本身的抖动由 app.js 的 handPath 生成 */
body[data-ball="hand"] .trend-path {
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

/* ── 面板里的一键套用 + 小样 ─────────────────────────────── */
.hand-preset {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #d9cfb4;
  border-radius: 10px;
  background:
    repeating-linear-gradient(0deg, transparent 0 13px, #dfe6f1 13px 14px),
    #fffdf6;
  color: #22314b;
  text-align: left;
  cursor: pointer;
}
.hand-preset:hover { border-color: var(--blue); }
.hand-preset-demo { display: flex; gap: 4px; flex: none; }
.hand-preset-demo i {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border: 2px solid #c0392b;
  border-radius: 47% 53% 44% 56% / 55% 45% 56% 44%;
  color: #c0392b;
  font: 16px/1 "Patrick Hand", "Kaiti SC", "KaiTi", cursive;
  font-style: normal;
}
.hand-preset-demo i + i { border-color: #0d6efd; color: #0d6efd; transform: rotate(-6deg); }
.hand-preset-copy { display: grid; gap: 2px; }
.hand-preset-copy strong { font-size: 14px; font-weight: 600; }
.hand-preset-copy span { font-size: 12px; color: #5d6576; }
body[data-skin="hand"][data-ball="hand"] #hand-preset { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }

.skin-opt[data-skin="hand"] .skin-swatch {
  background:
    linear-gradient(0deg, transparent 0 20px, #93a8c8 20px 21px, transparent 21px),
    repeating-linear-gradient(90deg, transparent 0 10px, #cfdaea 10px 11px),
    repeating-linear-gradient(0deg, transparent 0 10px, #cfdaea 10px 11px),
    #fffdf6;
}
.skin-opt[data-ball="hand"] .ball-swatch i {
  background: #fffdf6;
  border: 2px solid #c0392b;
  border-radius: 47% 53% 44% 56% / 55% 45% 56% 44%;
  color: #c0392b;
  font: 14px/1 "Patrick Hand", cursive;
  box-sizing: border-box;
}

/* 面板加了手绘一键套用和两个新选项后，桌面上会超出屏幕 —— 限高、内部滚动 */
.skin-pop { max-height: calc(100vh - 150px); overflow-y: auto; }

/* 手绘纸上的和值/跨度就是手写的数，不再套蓝色小方块 */
body[data-skin="hand"] .table-wrap .sum-badge {
  background: none !important;
  box-shadow: none !important;
  border: 0 !important;
  color: var(--hand-ink) !important;
  font-family: "Patrick Hand", "Kaiti SC", "STKaiti", "KaiTi", cursive !important;
  font-size-adjust: 0.5;
}
/* 开奖号等列在单元格里又包了一层 <strong>/<i> 并各自指定等宽体，手绘纸下一并改成手写 */
body[data-skin="hand"] .table-wrap :is(td, th) *:not(.hit-badge) {
  font-family: "Patrick Hand", "Kaiti SC", "STKaiti", "KaiTi", "楷体", cursive !important;
  font-size-adjust: 0.5;
}

/* 手机上「风格」「画图」改成文字后，控制条一行放不下，画图被挤到第二行。
   腾地方：期数下拉原本按最长选项「7期 · 短期信号」撑到 100px，但收起时只显示
   「30期」，给它定宽；视图下拉吃剩下的宽度；两个按钮不许压缩。 */
@media (max-width: 768px) {
  .controls { flex-wrap: nowrap; }
  .controls > label:has(#limit-select) { flex: 0 0 auto; }
  .controls #limit-select { width: 76px; }
  .controls .view-select-mobile { flex: 1 1 0; min-width: 0; text-overflow: ellipsis; }
  .controls .draw-toggle.text-toggle { flex: 0 0 auto; }
}
/* 控制条现在是 3 个下拉 + 3 个文字按钮（截图 / 风格 / 画图）。一般手机宽度下
   视图下拉会被挤到只剩「组选…」，所以再收一档：期数下拉 68px、间距和内边距都收紧，
   让视图下拉至少放得下「组选分析」四个字。 */
@media (max-width: 480px) {
  .controls { gap: 4px; }
  .controls #limit-select { width: 68px; }
  .controls .draw-toggle.text-toggle { padding: 0 5px; }
  .controls .view-select-mobile { padding: 0 20px 0 8px; }
}

/* ════════════════════════════════════════════════════════════
   白纸黑字走势图
   最朴素的那种：白底、黑字、灰格线、黑色实心圆圈号、黑色连线，一点彩色
   都没有 —— 像打印出来的黑白走势表。
   · 白纸黑字（data-skin="mono"）：底色 / 格线 / 表头 / 所有文字（含页脚）
   · 黑色实心（data-ball="mono"）：所有球 + 所有连线
   面板顶部「白纸黑字走势图」一键同时套上。
   ⚠ 没有深色版：名字就是「白纸」，深色主题下这张表照样是一张白纸（周围的
     页面还是深色）。文字颜色因此写死 #1a1a1a，不能用 var(--ink) —— 那个在
     深色主题下是浅色，白纸上就看不见了。
   ──────────────────────────────────────────────────────────── */
body[data-skin="mono"] {
  --skin-cell: #ffffff; --skin-alt: #ffffff; --skin-head: #ffffff;
  --skin-line: #d4d4d4; --skin-hover: #f1f1f1; --skin-divider: #4d4d4d;
  --mono-ink: #1a1a1a; --mono-omit: #3d3d3d;
}

/* 所有文字一律黑色。分区标题（百位红/十位蓝…）、开奖号的红字、特别号的蓝字、
   各种彩色小标签，统统收成黑。命中格本身的字是透明的（数字画在球上），跳过。 */
body[data-skin="mono"] .table-wrap :is(td, th, #\#):not(.hit-cell),
body[data-skin="mono"] .table-wrap :is(td, th) *:not(.hit-badge) {
  color: var(--mono-ink) !important;
}
body[data-skin="mono"] .table-wrap tbody td.omit { color: var(--mono-omit) !important; }
/* 和值/跨度的蓝色小方块 → 就是黑色数字 */
body[data-skin="mono"] .table-wrap .sum-badge {
  background: none !important;
  box-shadow: none !important;
  border: 0 !important;
}
/* 表头里各分区标题下面的彩色下划线收成灰。这些规则不少带 #id，
   同样借 :is(th, #\#) 把权重抬上去。 */
body[data-skin="mono"] .table-wrap :is(th, #\#) { border-bottom-color: #9a9a9a !important; }
/* 单元格里的小标签（基础走势指标区的形态/比值标签等）：去底色、边框收灰 */
body[data-skin="mono"] .table-wrap :is(td, th) :is(span, i, em, b, strong):not(.hit-badge) {
  background-color: transparent !important;
  border-color: #bdbdbd !important;
}
/* 表格里大量边框直接用页面的 --grid / --grid-soft（略带蓝的灰）。只在表格
   区域内把这两个变量换成纯灰 —— 变量会往下继承，一次盖住所有用到它们的规则；
   又不影响表格外的页面（深色主题下控制条的边框还是深色的）。 */
body[data-skin="mono"] .table-wrap { --grid: #c4c4c4; --grid-soft: #dcdcdc; }
/* 页脚「统计汇总」那一行上面的琥珀色分隔线 */
body[data-skin="mono"] .table-wrap :is(td, th, #\#).stat-section-cell { border-top-color: #9a9a9a !important; }
/* 冻结期号列右侧那道分隔阴影原来是蓝灰色 */
body[data-skin="mono"] .frozen-col { box-shadow: 1px 0 0 0 #c4c4c4 !important; }
/* 「添加一行预测」「删除」按钮的蓝色描边 → 灰 */
body[data-skin="mono"] .table-wrap .sel-add-row > td.sel-add-cell {
  background: #ffffff !important;
  border-bottom-color: #9a9a9a !important;
}
body[data-skin="mono"] .table-wrap :is(.sel-add-btn, .sel-del-btn) {
  border-color: #bdbdbd !important;
  color: var(--mono-ink) !important;
  background: #ffffff !important;
}

/* 页脚统计：其它背景皮肤不动页脚（彩色格有含义），但白纸黑字就是不要颜色。
   原来靠颜色区分的「该出了 / 刚出过」改成浅灰底 + 加粗，含义还在。 */
body[data-skin="mono"] .table-wrap tfoot :is(td, th) {
  background: #ffffff !important;
  color: var(--mono-ink) !important;
  border-right-color: var(--skin-line) !important;
  border-bottom-color: var(--skin-line) !important;
}
body[data-skin="mono"] .table-wrap tfoot :is(.stat-label, .stat-section-cell) { background: #f6f6f6 !important; }
body[data-skin="mono"] .table-wrap tfoot :is(.stat-omit-due, .stat-omit-fresh, .stat-due-strong) {
  background: #e6e6e6 !important;
  font-weight: 600;
}
/* 我的选号那一行：原来是淡蓝底，改成淡灰 */
body[data-skin="mono"] .table-wrap tbody > tr.sel-row > td {
  background: #f7f7f7 !important;
  background-color: #f7f7f7 !important;
}

/* 黑色实心：所有球都是黑圆白字，包括组选分析的形态色片、比值/形态的胶囊标签 */
body[data-ball="mono"] .hit-badge {
  background: #1a1a1a !important;
  color: #ffffff !important;
  box-shadow: none !important;
  text-shadow: none !important;
  border: 0 !important;
}
/* 连线全部黑色。ssq 等视图的线色是 JS 写在元素上的内联样式，必须 !important */
body[data-ball="mono"] .trend-path {
  stroke: #1a1a1a !important;
  opacity: 0.75;
}
/* 预测虚线同样黑色，保持虚线以区分「开出」和「我猜的」 */
body[data-ball="mono"] .trend-path.pred-path { opacity: 0.6; }

/* ── 面板：一键套用卡片 + 小样 ────────────────────────────── */
.hand-preset.mono-preset {
  border-color: #bdbdbd;
  background: #ffffff;
  color: #1a1a1a;
}
.mono-preset .hand-preset-demo i,
.mono-preset .hand-preset-demo i + i {
  border: 0;
  border-radius: 50%;
  background: #1a1a1a;
  color: #ffffff;
  font: 600 12px/1 var(--font-mono);
  transform: none;
}
.mono-preset .hand-preset-copy span { color: #555555; }
body[data-skin="mono"][data-ball="mono"] #mono-preset { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }

.skin-opt[data-skin="mono"] .skin-swatch {
  background:
    repeating-linear-gradient(90deg, transparent 0 10px, #d4d4d4 10px 11px),
    repeating-linear-gradient(0deg, transparent 0 10px, #d4d4d4 10px 11px),
    #ffffff;
}
.skin-opt[data-skin="mono"] .skin-swatch::after { background: #1a1a1a; }
.skin-opt[data-ball="mono"] .ball-swatch i { background: #1a1a1a; color: #ffffff; }

/* ── 海外站（英文）：静态文字翻译完之前不显示，免得先闪一下中文 ──
   app.js 翻译完给 <html> 加 .i18n-ready。万一脚本没跑起来，3 秒后照样显示
   （visibility 可以做离散动画），页面不会一直空白。国内站没有 data-site，不受影响。 */
html[data-site="overseas"]:not(.i18n-ready) body {
  visibility: hidden;
  animation: i18n-reveal 0s 3s forwards;
}
@keyframes i18n-reveal { to { visibility: visible; } }

/* 海外站（英文）手机端：组选分析右半边（组选分布 / 升降序 / 数值 / 形态，第 23-38 列）
   的英文标签（Down / Peak / Last / Sprd / Mix…）比中文两个字宽，24px 放不下。
   只在英文站放宽到 38px（Down / Peak 胶囊 37px）；html[lang] 抬高权重，压过上面那条 24px !important。 */
@media (max-width: 768px) {
  html[lang="en"] #zxfx-table thead tr:nth-child(3) th:nth-child(n+23),
  html[lang="en"] #zxfx-table tbody td:nth-child(n+23) {
    width: 38px !important; min-width: 38px !important; max-width: 38px !important;
  }
}

/* ── Site footer on the chart page: disclaimer + links ─────────────────────
   Unlike the old one-line footer it carries the "not affiliated" notice, so it
   stays visible on phones too. */
.page-foot.site-foot { display: block; text-align: left; font-size: 12px; line-height: 1.5; }
.page-foot.site-foot p { margin: 4px 0; }
.page-foot.site-foot a { color: inherit; text-decoration: underline; }
.page-foot.site-foot .foot-short { display: none; }
@media (max-width: 768px) {
  .page-foot.site-foot { margin-top: 10px; padding: 6px 10px; font-size: 11px; line-height: 1.4; }
  .page-foot.site-foot .foot-full, .page-foot.site-foot .foot-links { display: none; }
  .page-foot.site-foot .foot-short { display: block; }
}
a.brand-mark { text-decoration: none; }
#lottery-select[hidden] { display: none; }
