/* v2 の名鑑のランキング（features/book/rank-tab.js・rank-debug.js）と棋風のシート（ui/factor-sheet.js）。旧 features/book/book.css の写し。色は ../ui/style.css の変数（light / dark） */
.bk-toggle-btn[aria-pressed='true'] { background: var(--accent); color: #fff; }
button.bk-toggle-btn { border: none; border-radius: 0; }
.bk-variants { display: flex; width: 100%; margin: 0 0 8px; }
.bk-variants .bk-toggle-btn { flex: 1 1 0; min-width: 0; }
.bk-rank-controls .bk-field-wide { grid-column: span 2; }
@media (max-width: 380px) {
  .bk-rank-controls .bk-field-wide { grid-column: 1 / -1; }
}

/* ルールのチップ（総合 → 狐の動き → 休み → トライ） */
.bk-rule { display: grid; gap: 4px; margin: 0 0 10px; }
.bk-rule-row { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); align-items: start; gap: 6px; min-width: 0; }
.bk-rule-label { padding-top: 8px; font-size: 0.72rem; font-weight: 700; color: var(--text-2); }
.bk-rule-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.bk-rule-chip { padding: 4px 10px; min-height: 40px; font-size: 0.8rem; }
.bk-rule-all:not([aria-pressed='true']) { border-style: dashed; }

/* 差 / 値・昇順 / 降順 */
.bk-rank-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.bk-rank-tools .bk-toggle { display: inline-flex; width: auto; margin: 0; }
.bk-rank-tools .bk-toggle[hidden] { display: none; }
.bk-rank-tools .bk-toggle-btn { flex: none; padding: 6px 14px; min-height: 34px; }
.bk-order { margin-left: auto; padding: 6px 12px; min-height: 40px; font-size: 0.85rem; font-weight: 700; }

/* 指標の定義（1 位の上） */
.bk-def { margin: 4px 0 6px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 8px 8px 0; font-size: 0.74rem; color: var(--text-2); line-height: 1.45; }
.bk-def p { margin: 0; overflow-wrap: anywhere; }
.bk-def .bk-def-note { margin-top: 4px; color: var(--text); }
/* 指標の名前＋「？」＋選んだ条件（要件定義 D。定義・単位は「？」のポップアップ） */
.bk-rank-head-line { font-size: 0.85rem; color: var(--text); }
.bk-rank-head-scope { font-size: 0.74rem; color: var(--text-2); }

/* ランキングの行 */
.bk-rank { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.bk-rank > li { display: grid; grid-template-columns: 2em minmax(0, 1fr); align-items: center; gap: 6px; }
.bk-rank-no { text-align: right; font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bk-rank-item { display: block; width: 100%; padding: 6px 10px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); box-sizing: border-box; font: inherit; }
button.bk-rank-item:hover { border-color: var(--accent); }
.bk-rank-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: baseline; }
.bk-rank-name { font-weight: 700; font-size: 0.88rem; overflow-wrap: anywhere; }
.bk-rank-val { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.85rem; text-align: right; }
.bk-rank-val small { color: var(--text-2); font-size: 0.7rem; }
.bk-bar { display: block; height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.bk-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bk-bar-neg > span { background: var(--fox-edge); }
.bk-rank-n { color: var(--text-2); font-size: 0.75rem; white-space: nowrap; text-align: right; }
.bk-low .bk-rank-item, .bk-pending .bk-rank-item { opacity: 0.6; }
.bk-pending .bk-rank-val { color: var(--text-2); }
/* 「あなた」の行（強調は ZUKAN の rank-extra.css の .rx-me・一言は .rx-me-note） */
.bk-me .bk-rank-no { color: var(--text); }
.bk-me .bk-rank-n { grid-column: 1 / -1; }

/* デバッグ表示（/book/rank/all） */
.bk-debug-flag { margin: 0 0 8px; padding: 6px 10px; border: 2px dashed var(--fox-edge); border-radius: 8px; font-size: 0.8rem; font-weight: 700; }
.bk-dbg-sec { margin: 18px 0 0; }
.bk-dbg-h { margin: 0 0 4px; font-size: 0.95rem; overflow-wrap: anywhere; }
.bk-dbg-h small { color: var(--text-2); font-size: 0.68rem; font-weight: 400; }
.bk-dbg { width: 100%; border-collapse: collapse; font-size: 0.72rem; font-variant-numeric: tabular-nums; table-layout: fixed; }
.bk-dbg th, .bk-dbg td { padding: 2px 4px; border-bottom: 1px solid var(--border); text-align: right; overflow-wrap: anywhere; }
.bk-dbg th[scope='row'] { text-align: left; font-weight: 600; }
.bk-dbg thead th { color: var(--text-2); font-weight: 700; }
.bk-dbg thead th:nth-child(2) { text-align: left; }
.bk-dbg thead th:nth-child(1) { width: 2em; }
.bk-dbg thead th:nth-child(2) { width: 30%; }
.bk-dbg thead th:nth-child(5) { width: 5.2em; }
.bk-dbg td small, .bk-dbg th small { color: var(--text-2); font-size: 0.62rem; font-weight: 400; }
.bk-dbg .bk-dbg-n { white-space: nowrap; font-size: 0.66rem; color: var(--text-2); }
.bk-dbg tr.bk-low, .bk-dbg tr.bk-pending { opacity: 0.6; }

/* 棋風のシート（枠は ui/book-ui.css の .fs-*） */
.ss-head { display: grid; gap: 2px; }
.ss-table td small.ss-z { color: var(--text-2); font-size: 0.68rem; }
.ss-table tr.fs-pending td { color: var(--text-2); }
.ss-foxes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ss-fox { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 10px; padding: 6px 10px; min-height: 48px; text-align: left; box-sizing: border-box; }
.ss-fox-locked { border: 1px dashed var(--border); border-radius: 10px; color: var(--text-2); }
.ss-fox-face { line-height: 1; }
.ss-fox-main { display: grid; gap: 1px; min-width: 0; }
.ss-fox-meta { color: var(--text-2); font-size: 0.7rem; }
/* 「影響｜平均値」・短い定義・？ の 1 行と、選ぶ欄の横の「？」・「この表について」（原文 2026-10-11 ランキング） */
.bk-rank-head-how { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bk-rank-head-how .bk-toggle { margin: 0; }
.bk-field-help { align-self: end; }
.bk-note-more > summary { cursor: pointer; }
.bk-note-more ul { margin: 4px 0 0; padding-left: 1.2em; }
