/* 二阶关联 / 连续形态 / 均衡度 / 海洋房间对比 (js/pages/jfadv/bot.js). Scoped under .pg-jiufa .adv; tokens only.
   Shared pieces (.adv-bar, .adv-periods, .adv-insight, .adv-empty) live in jfadv.css; the 房间对比 table reuses the
   real comparison's classes from jiufa.css (.jf-ft .jf-cmp .jf-cmp-hot .jf-ent-*). */

.pg-jiufa .adv .advb-t { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--text-2); }
/* Deviation colours (jiufa.css .jf-dev) must win over the card value colours below (.advb-kpi strong, .advb-vals dd). */
.pg-jiufa .adv .jf-dev.up { color: var(--accent); }
.pg-jiufa .adv .jf-dev.down { color: var(--info); }
.pg-jiufa .adv .jf-dev.flat { color: var(--text-2); }
.pg-jiufa .adv .adv-insight .jf-chip { vertical-align: middle; margin: -3px 2px 0; }

/* ---------- KPI cards (summary / metrics / pattern cards) ---------- */
.pg-jiufa .adv .advb-sum,
.pg-jiufa .adv .advb-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.pg-jiufa .adv .advb-kpi {
  min-width: 0; display: grid; align-content: center; justify-items: center; gap: 3px; padding: 8px 10px; min-height: 72px;
  border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel-3); text-align: center;
}
.pg-jiufa .adv .advb-kpi > .k { font-size: 12px; color: var(--text-3); }
.pg-jiufa .adv .advb-kpi > small { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.pg-jiufa .adv .advb-kpi strong { font-size: 20px; font-weight: 700; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.pg-jiufa .adv .advb-kpi strong > small { margin-left: 2px; font-family: var(--font); font-size: 12px; font-weight: 400; color: var(--text-3); }
.pg-jiufa .adv .advb-kpi strong.faint { color: var(--text-3); }
.pg-jiufa .adv .advb-kpi.is-hl { border-color: var(--accent-line); background: var(--accent-soft); }
.pg-jiufa .adv .advb-kpi.is-hl strong { color: var(--accent); }
.pg-jiufa .adv .advb-src, .pg-jiufa .adv .advb-best, .pg-jiufa .adv .advb-top { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 26px; }
.pg-jiufa .adv .advb-src > b { color: var(--accent); font-size: 16px; line-height: 1; }
.pg-jiufa .adv .advb-topi { display: inline-grid; justify-items: center; gap: 2px; }
.pg-jiufa .adv .advb-topi small { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pg-jiufa .adv .advb-help {
  margin: 0 10px; padding: 6px 10px; border-left: 2px solid var(--accent); background: var(--accent-soft);
  font-size: 12px; line-height: 1.6; color: var(--text-2);
}
.pg-jiufa .adv .advb-help b { color: var(--text); font-weight: 600; }

/* ---------- 二阶关联: distribution grid + recent matches ---------- */
.pg-jiufa .adv .advb-pd { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .85fr); gap: 10px; padding: 10px; align-items: start; }
.pg-jiufa .adv .advb-pg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pg-jiufa .adv .advb-pg.n8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pg-jiufa .adv .advb-pc {
  min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel-3);
}
.pg-jiufa .adv .advb-pc.is-top { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); background: var(--accent-soft); }
.pg-jiufa .adv .advb-pc-b { min-width: 0; display: grid; gap: 4px; }
.pg-jiufa .adv .advb-pc-b > b { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the share stays whole; the label (「派对企鹅 · 」) shortens first, and a 4-character label gets tighter letters */
.pg-jiufa .adv .advb-pc-b > b { display: flex; min-width: 0; }
.pg-jiufa .adv .advb-pc-b > b > .advb-pc-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; }
.pg-jiufa .adv .advb-pc-b > b > .mono { flex: none; }
.pg-jiufa .adv .advb-pc.is-long .advb-pc-b > b { letter-spacing: -0.5px; }
.pg-jiufa .adv .advb-pc-b > small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-jiufa .adv .advb-meter { position: relative; display: block; height: 6px; border-radius: 3px; background: var(--line-soft); }
.pg-jiufa .adv .advb-meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.pg-jiufa .adv .advb-meter em { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text-2); }
.pg-jiufa .adv .advb-recent { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel-3); }
.pg-jiufa .adv .advb-recent h3 { padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--text-2); }
.pg-jiufa .adv .advb-rt { min-width: 0; }
.pg-jiufa .adv .advb-rt thead th { position: static; background: transparent; text-align: center; }
.pg-jiufa .adv .advb-rt td { text-align: center; }
.pg-jiufa .adv .advb-rt tbody tr:nth-child(even) td { background: transparent; }
.pg-jiufa .adv .advb-rt td:last-child { line-height: 0; }
.pg-jiufa .adv .advb-two { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); }
.pg-jiufa .adv .advb-none { padding: 24px 12px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------- 连续形态 ---------- */
.pg-jiufa .adv .advb-seq { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 10px 4px; overflow-x: auto; scrollbar-width: thin; }
.pg-jiufa .adv .advb-seq-k { flex: none; font-size: 12px; color: var(--text-3); }
.pg-jiufa .adv .advb-seq-i { flex: none; display: inline-flex; }
.pg-jiufa .adv .advb-seq-i.is-new .jf-chip { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--accent); }
.pg-jiufa .adv .advb-pat { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 10px; }
/* result-card games (no 九法 board): only 重号 / 轮换 */
.pg-jiufa .adv .advb-pat.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pg-jiufa .adv .advb-pt { justify-items: start; align-content: start; text-align: left; gap: 4px; padding: 10px; }
.pg-jiufa .adv .advb-pt > .k { color: var(--text-2); font-weight: 600; }
.pg-jiufa .adv .advb-pt > b { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pg-jiufa .adv .advb-pt-t { font-weight: 400; color: var(--text-3); }
.pg-jiufa .adv .advb-pt > .advb-desc { justify-self: stretch; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.pg-jiufa .adv .advb-pt.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.pg-jiufa .adv .advb-pt.is-on > .k, .pg-jiufa .adv .advb-pt.is-on > b { color: var(--accent); }

/* ---------- 均衡度 ---------- */
.pg-jiufa .adv .advb-short { color: var(--accent); }
.pg-jiufa .adv .advb-dev { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 10px 10px; }
.pg-jiufa .adv .advb-dev.n8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pg-jiufa .adv .advb-dc { min-width: 0; display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--panel-3); }
.pg-jiufa .adv .advb-dc header { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pg-jiufa .adv .advb-dc-h { min-width: 0; display: grid; gap: 1px; }
.pg-jiufa .adv .advb-dc-h b { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-jiufa .adv .advb-dc-h small { font-size: 12px; color: var(--text-3); }
.pg-jiufa .adv .advb-vals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.pg-jiufa .adv .advb-vals > div { min-width: 0; display: grid; gap: 1px; }
.pg-jiufa .adv .advb-vals dt { font-size: 12px; color: var(--text-3); }
.pg-jiufa .adv .advb-vals dd { margin: 0; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-jiufa .adv .advb-dm { position: relative; display: block; height: 6px; border-radius: 3px; background: var(--line-soft); }
.pg-jiufa .adv .advb-dm i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--text-3); }
.pg-jiufa .adv .advb-dm i.up { background: var(--accent); }
.pg-jiufa .adv .advb-dm i.down { background: var(--info); }
.pg-jiufa .adv .advb-dm b { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: #4A5260; }

/* ---------- 房间对比 (sample) ---------- */
.pg-jiufa .adv .advb-smp { font-size: 12px; }
.pg-jiufa .adv .advb-hotn { margin-left: 8px; font-size: 12px; color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.pg-jiufa .adv .advb-curtag {
  display: inline-block; margin-left: 6px; padding: 0 4px; border: 1px solid var(--accent-line); border-radius: 3px;
  font-size: 12px; font-weight: 400; line-height: 16px; color: var(--accent); vertical-align: 1px;
}

/* ---------- tablet ---------- */
@media (max-width: 1023px) {
  .pg-jiufa .adv .advb-pd { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- mobile ---------- */
@media (max-width: 767px) {
  .pg-jiufa .adv .advb-sum, .pg-jiufa .adv .advb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; }
  .pg-jiufa .adv .advb-kpi { min-height: 76px; padding: 8px 6px; }
  .pg-jiufa .adv .advb-kpi strong { font-size: 18px; }
  .pg-jiufa .adv .advb-help { margin: 0 8px; }
  .pg-jiufa .adv .advb-pd { padding: 8px; gap: 8px; }
  .pg-jiufa .adv .advb-pg.n8 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* phone: mark + share on the first row, bar and counts across the full card width below */
  .pg-jiufa .adv .advb-pc { align-items: center; gap: 5px 6px; padding: 6px; }
  .pg-jiufa .adv .advb-pc-b { display: contents; }
  .pg-jiufa .adv .advb-pc-b > .advb-meter, .pg-jiufa .adv .advb-pc-b > small { grid-column: 1 / -1; }
  .pg-jiufa .adv .advb-pc-b > small { white-space: normal; line-height: 1.4; }
  /* 九法 3 × 3: the chip already shows the number, so 「3号 · 」 is dropped to keep the share whole */
  .pg-jiufa .adv .advb-pg.n9 .advb-pc-l { display: none; }
  /* 18 chips as two rows of nine (old → new, left to right) instead of a sideways scroll */
  .pg-jiufa .adv .advb-seq { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); justify-items: center; gap: 8px 2px; padding: 10px 8px 2px; overflow: visible; }
  .pg-jiufa .adv .advb-seq-k { display: none; }
  .pg-jiufa .adv .advb-pat { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; }
  .pg-jiufa .adv .advb-pat > :last-child { grid-column: 1 / -1; }
  .pg-jiufa .adv .advb-pat.n2 > :last-child { grid-column: auto; }
  .pg-jiufa .adv .advb-dev, .pg-jiufa .adv .advb-dev.n8 { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 8px 8px; }
  .pg-jiufa .adv .advb-dev.n9 > :last-child { grid-column: 1 / -1; } /* 九法: the 9th card closes the 2-column grid */
  .pg-jiufa .adv .advb-dc { padding: 8px 6px; }
  .pg-jiufa .adv .advb-vals { gap: 4px; }
  .pg-jiufa .adv .advb-vals dd { font-size: 12px; }
}
