/* ============================================================
   E-計算！ Math — 割合の信頼区間（proportion-interval.html）だけで使う見た目
   共通（../assets/css/ek.css・css/math.css）の上に重ねる。色は変数だけを使う。
   ============================================================ */

/* ページ上部の要点 */
.pi-quick { margin: 4px 0 20px; }
.pi-quick ul { margin: 2px 0 0; }
.pi-quick li { margin: 2px 0; }

/* 入力の誤り（math.css の .vp-row input.bad と同じ見た目） */
html[data-ui="v2"] .input-unit input.bad { border-color: var(--s2, #B4442C); border-width: 2px; }
.pi-boxB { border-top: 1px dashed var(--grid); padding-top: 14px; margin-bottom: 4px; }

/* 結果の大きな数字は狭い画面で縮める（「14.37〜15.63」が1行に収まるように） */
html[data-ui="v2"] #resultPanel .res-hero .big b, html[data-ui="v2"] #size .res-hero .big b { font-size: clamp(30px, 9vw, 44px); overflow-wrap: anywhere; }
/* 件数がとても多いと小数の桁が増えるので、小さい数字の欄も折り返せるようにする */
html[data-ui="v2"] #resultPanel .res-mini .v { overflow-wrap: anywhere; }

/* ---- 区間の図（SVG。x は % で置くので文字の大きさは画面幅で変わらない） ---- */
.pi-fig { margin: 18px 0 0; padding: 16px 16px 10px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--surface); min-width: 0; }
.pi-fig figcaption { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 8px; line-height: 1.6; }
.pi-fig figcaption small { font-weight: 400; color: var(--muted); font-size: 12px; }
.pi-fig svg { display: block; width: 100%; overflow: visible; }
.pi-svg text { font-size: 12.5px; fill: var(--ink); }
.pi-svg text.val { font-weight: 700; font-variant-numeric: tabular-nums; }
.pi-svg text.tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.pi-svg .pi-track { stroke: var(--grid); stroke-width: 1; }
.pi-svg .pi-axis { stroke: var(--baseline, var(--grid)); stroke-width: 1; }
.pi-svg .pi-tickline { stroke: var(--grid); stroke-width: 1; }
.pi-svg .pi-bar.wilson { fill: var(--accent); }
.pi-svg .pi-bar.cp { fill: color-mix(in srgb, var(--ink) 34%, var(--surface)); }
.pi-svg .pi-bar.wald { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.pi-svg .pi-bar.b { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.pi-svg .pi-zero { stroke: var(--muted); stroke-width: 3; }
.pi-svg .pi-pt { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.pi-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 */
.pi-row + .pi-row { margin-top: 8px; }
.pi-row-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.pi-row-h .pi-lab { min-width: 0; overflow-wrap: anywhere; }
.pi-row-h .pi-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.pi-fig svg.pi-bar-svg { margin-top: 2px; }
.pi-fig svg.pi-axis-svg { margin-top: 4px; }

/* ---- 包含率の線グラフ ---- */
.pi-svg .pi-grid { stroke: var(--grid); stroke-width: 1; fill: none; }
.pi-svg .pi-nominal { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; fill: none; }
.pi-svg .pi-ln { fill: none; stroke-linejoin: round; }
.pi-svg .pi-ln.wilson { stroke: var(--accent); stroke-width: 2.2; }
.pi-svg .pi-ln.cp { stroke: var(--ink-2); stroke-width: 1.6; stroke-dasharray: 7 4; }
.pi-svg .pi-ln.wald { stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 2 3; }
/* 縦軸の目盛りの文字は図の左の外（HTML）に置き、線と重ねない */
.pi-cov { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; }
.pi-cov-y { position: relative; min-width: 2.7em; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pi-cov-y span { position: absolute; right: 0; transform: translateY(-50%); line-height: 1; white-space: nowrap; }
.pi-fig svg.pi-cov-plot { border-left: 1px solid var(--grid); }
.pi-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 0 0 10px; font-size: 12px; color: var(--ink-2); }
.pi-legend li { display: flex; align-items: center; gap: 6px; }
.pi-legend svg { width: 26px; height: 10px; flex: none; }

/* ---- 必要な件数の目安 ---- */
.pi-size-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; align-items: end; }
.pi-size-grid .field { margin-bottom: 14px; }
/* 方法の表：方法名は折り返してよい（狭い画面で横にはみ出さないように） */
table.data.pi-methods td:first-child { white-space: normal; min-width: 7.5em; }
/* 結果の補足の表：見出しは折り返してよい（「Clopper–Pearson法」を2行に） */
table.data.pi-wrap thead th { white-space: normal; word-break: keep-all; }
html[data-ui="v2"] table.data tbody tr.hit td .sub { color: var(--muted); font-weight: 400; }
