/* ============================================================
   E-計算！ Math — 2つの割合の比較（two-proportions.html）だけで使う見た目
   共通（../assets/css/ek.css・css/math.css）の上に重ねる。色は変数だけを使う。
   区間の図の形は割合の信頼区間（css/proportion-interval.css）とそろえてある（クラス名は tp- で別にした）。
   ============================================================ */

/* ページ上部の要点 */
.tp-quick { margin: 4px 0 20px; }
.tp-quick ul { margin: 2px 0 0; }
.tp-quick li { margin: 2px 0; }

/* 入力：A・B のまとまり */
.tp-grp + .tp-grp { border-top: 1px dashed var(--grid); padding-top: 12px; }
.tp-grp-h { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.tp-grp-h .tp-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; font-size: 13px; color: var(--surface); background: var(--accent); }
.tp-grp-h .tp-badge.b { background: color-mix(in srgb, var(--ink) 55%, var(--surface)); }
.tp-grp-h small { font-weight: 400; color: var(--muted); font-size: 12px; }
html[data-ui="v2"] .input-unit input.bad { border-color: var(--s2, #B4442C); border-width: 2px; }

/* 結果の大きな数字は狭い画面で縮める（「−0.1〜+3.5」が1行に収まるように） */
html[data-ui="v2"] #resultPanel .res-hero .big b, html[data-ui="v2"] #size .res-hero .big b { font-size: clamp(28px, 8.5vw, 44px); overflow-wrap: anywhere; }
html[data-ui="v2"] #resultPanel .res-mini .v { overflow-wrap: anywhere; }
html[data-ui="v2"] #resultPanel .res-mini .s { overflow-wrap: anywhere; }
/* 単位（ポイント・%・件）は語の途中で折り返さない（10億件どうしの長い値で「ポイン／ト」になっていた）。数字の側が折り返す */
html[data-ui="v2"] #resultPanel .res-hero .big span, html[data-ui="v2"] #size .res-hero .big span,
html[data-ui="v2"] #resultPanel .res-mini .v small { white-space: nowrap; }

/* 結果の小見出し */
.tp-h3 { font-size: 15px; font-weight: 700; margin: 22px 0 6px; color: var(--ink); }

/* ---- 区間の図（SVG。x は % で置くので文字の大きさは画面幅で変わらない） ---- */
.tp-fig { margin: 18px 0 0; padding: 16px 16px 10px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--surface); min-width: 0; }
.tp-fig figcaption { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 8px; line-height: 1.6; }
.tp-fig figcaption small { font-weight: 400; color: var(--muted); font-size: 12px; }
.tp-fig svg { display: block; width: 100%; overflow: visible; }
.tp-svg text.tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.tp-svg .tp-track { stroke: var(--grid); stroke-width: 1; }
.tp-svg .tp-axis { stroke: var(--baseline, var(--grid)); stroke-width: 1; }
.tp-svg .tp-tickline { stroke: var(--grid); stroke-width: 1; }
.tp-svg .tp-zero { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .7; }
.tp-svg .tp-bar.nc { fill: var(--accent); }
.tp-svg .tp-bar.wald { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.tp-svg .tp-bar.a { fill: var(--accent); }
.tp-svg .tp-bar.b { fill: color-mix(in srgb, var(--ink) 40%, var(--surface)); }
.tp-svg .tp-bar.lap { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.tp-svg .tp-pin { stroke: var(--muted); stroke-width: 3; }
.tp-svg .tp-pt { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.tp-fig-note { font-size: 11.5px; color: var(--ink-2); line-height: 1.8; padding-top: 10px; margin: 6px 0 0; border-top: 1px solid var(--grid); }
/* 区間の図の1行：名前と値は HTML（狭い画面では値が次の行へ回る）、棒だけ SVG */
.tp-row + .tp-row { margin-top: 8px; }
.tp-row-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.tp-row-h .tp-lab { min-width: 0; overflow-wrap: anywhere; }
.tp-row-h .tp-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.tp-fig svg.tp-bar-svg { margin-top: 2px; }
.tp-fig svg.tp-axis-svg { margin-top: 4px; }

/* ---- 表 ---- */
table.data.tp-wrap thead th { white-space: normal; word-break: keep-all; }
table.data.tp-wrap td:first-child { white-space: normal; min-width: 7em; }
table.data td.tp-yes .sub { color: var(--accent); }
html[data-ui="v2"] table.data tbody tr.hit td .sub { color: var(--muted); font-weight: 400; }
table.data td.tp-yes { color: var(--accent); font-weight: 700; }
table.data.tp-22 td.n .sub { display: block; }
/* 検定の表：320px で表が枠（260px）に収まらず、p値の列が切れていた。
   p値の列は JS が入れる <wbr>（「0.0001／未満」「5%を／下回る」）でだけ折り返してよい。
   keep-all なので、数字（p値・χ²）や「計算できません」「下回らない」の途中では折り返さない */
table.data#tests td.n { white-space: normal; word-break: keep-all; }
@media (max-width: 480px) {
  /* 狭い画面では、検定の列の最小幅を 7em → 5em、セルの左右の余白を 10px → 6px に詰める（検定の名前は折り返す） */
  html[data-ui="v2"] table.data#tests th, html[data-ui="v2"] table.data#tests td { padding-left: 6px; padding-right: 6px; }
  table.data#tests td:first-child { min-width: 5em; }
}

/* ---- 必要な件数の目安 ---- */
.tp-size-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; align-items: end; }
.tp-size-grid .field { margin-bottom: 14px; }
