/* ============================================================
   E-計算！ Math — 確率の計算（probability.html）だけで使う見た目
   共通（../assets/css/ek.css・css/math.css）の上に重ねる。色は変数だけを使う。
   ============================================================ */

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

/* 計算すること（2つの切り替え）：狭い画面でも名前の途中で折り返さない */
html[data-ui="v2"] form .radio-row.pb-modes > label { white-space: nowrap; min-width: 0; }
.pb-mode-note { margin: 6px 0 0; font-size: 12.5px; }
#fsRep[hidden], #fsNr[hidden] { display: none !important; }

/* 数と入れ方（% / 分数）の選択を横に並べる */
.pb-vu { display: flex; gap: 8px; align-items: center; min-width: 0; }
.pb-vu > input { flex: 1 1 auto; min-width: 0; }
html[data-ui="v2"] .field .pb-vu select { flex: 0 0 5.5em; width: 5.5em; min-width: 0; max-width: 100%; }
html[data-ui="v2"] .pb-vu input[type="text"] {
  width: 100%; min-width: 0; height: 44px; padding: 0 12px; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
}
html[data-ui="v2"] .pb-vu input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
@media (max-width: 560px) { html[data-ui="v2"] .pb-vu input[type="text"] { font-size: 16px; } }   /* iOS で入力時に拡大されないように */
/* 入力の誤り（math.css の .vp-row input.bad と同じ見た目） */
html[data-ui="v2"] .input-unit input.bad, html[data-ui="v2"] .pb-vu input.bad { border-color: var(--s2, #B4442C); border-width: 2px; }
html[data-ui="v2"] .input-unit input::placeholder { color: var(--muted); }
/* flex・grid の子が縮まずにはみ出さないように（320px の画面） */
#form .field, #form .input-unit, #form .input-unit input { min-width: 0; }

/* くわしい条件（入力の中の折りたたみ） */
html[data-ui="v2"] details.why.pb-more { margin-top: 6px; }
html[data-ui="v2"] .pb-more > summary { margin-bottom: 0; }
html[data-ui="v2"] .pb-more[open] > summary { margin-bottom: 14px; }
.pb-more-hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.pb-more .field:last-child { margin-bottom: 4px; }

/* 結果の大きな数字は狭い画面で縮める。数字の途中では折り返さない（ページの script がカンマのあとに <wbr> を入れる） */
html[data-ui="v2"] .pb-out .res-hero .big b { font-size: clamp(28px, 8.5vw, 44px); overflow-wrap: normal; }
html[data-ui="v2"] .pb-out .res-mini .v { overflow-wrap: normal; word-break: normal; }
html[data-ui="v2"] .pb-out .res-mini .v small { white-space: nowrap; }
html[data-ui="v2"] .pb-out .res-mini .s { overflow-wrap: anywhere; }
@media (max-width: 400px) {   /* 320px の画面で小さな箱の中は約70px */
  html[data-ui="v2"] .pb-out .res-mini .v { font-size: 15px; }
  html[data-ui="v2"] .pb-out .res-mini .v.long { font-size: 14px; }
}
/* それでも欄からはみ出す数がある行は、3つの箱を縦に並べる（ページの script の fitMinis が付ける） */
html[data-ui="v2"] .pb-out .res-mini.pb-stack { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
html[data-ui="v2"] .pb-out .res-mini.pb-stack > div { padding: 0; }
html[data-ui="v2"] .pb-out .res-mini.pb-stack > div + div { border-left: 0; padding: 10px 0 0; border-top: 1px solid var(--grid); }
/* 結果の欄の高さを先に確保する（読み込み直後の計算で下の要素が動かないように）。calc が最初に .pb-pending を外す */
#result { min-height: 330px; }
#resultPanel.pb-pending { min-height: 760px; }
#resultPanel [hidden] { display: none !important; }
.pb-out .verdict { margin-top: 12px; line-height: 1.8; }
.pb-premise { margin: 12px 0 0; font-size: 12.5px; line-height: 1.7; }
.pb-ceil-t { display: block; font-weight: 700; margin-bottom: 4px; }
.pb-ceil small { display: block; margin-top: 4px; color: var(--ink-2); }
.pb-h3 { margin: 20px 0 4px; font-size: 15px; }
.pb-tnote { margin: 6px 0 0; font-size: 12.5px; line-height: 1.7; }
table.data.pb-cmp th.n, table.data.pb-cmp td.n { min-width: 6em; }

/* ---- 棒グラフ（行の名前と値は HTML、棒だけ SVG） ---- */
.pb-fig { margin: 16px 0 0; padding: 14px 16px 10px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--surface); min-width: 0; }
.pb-fig figcaption { font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 8px; line-height: 1.6; }
.pb-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); }
.pb-legend li { display: flex; align-items: center; gap: 6px; }
.pb-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.pb-legend i.s1 { background: var(--accent); }
.pb-legend i.s2 { background: color-mix(in srgb, var(--ink) 28%, var(--surface)); }
.pb-row { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 8px; align-items: center; padding: 3px 0; }
.pb-row + .pb-row { border-top: 1px solid var(--grid); }
.pb-lab { min-width: 0; font-size: 12.5px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.pb-row.sel .pb-lab { font-weight: 700; }
.pb-series { min-width: 0; }
.pb-line { display: grid; grid-template-columns: minmax(0, 1fr) 7.2em; gap: 6px; align-items: center; min-width: 0; }
.pb-fig svg.pb-bar { display: block; width: 100%; height: 16px; min-width: 0; }
.pb-bar .pb-track { fill: var(--page); }
.pb-line.s1 .pb-fill { fill: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.pb-row.sel .pb-line.s1 .pb-fill { fill: var(--accent); }
.pb-line.s2 .pb-fill { fill: color-mix(in srgb, var(--ink) 28%, var(--surface)); }
.pb-row.sel .pb-line.s2 .pb-fill { fill: color-mix(in srgb, var(--ink) 45%, var(--surface)); }
.pb-val { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.3; }
/* 単位（%・%未満・%より大きい）は途中で折らず、数のあとの <wbr> で単位ごと次の行へ（320px で「99.9999%より大きい」が欄からはみ出さないように） */
.pb-val small { font-size: 10.5px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.pb-fig-note { font-size: 11.5px; color: var(--ink-2); line-height: 1.8; padding-top: 8px; margin: 10px 0 0; border-top: 1px solid var(--grid); }
@media (max-width: 400px) {
  .pb-row { grid-template-columns: 5.4em minmax(0, 1fr); gap: 6px; }
  .pb-line { grid-template-columns: minmax(0, 1fr) 6.6em; }
  .pb-val { font-size: 12px; }
}

/* ---- 計算式と内訳 ---- */
.pb-fl { display: block; margin: 0 0 6px; overflow-wrap: anywhere; }

/* ---- 解説の式と表 ---- */
.pb-eq { padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--page); border-radius: 0 var(--r) var(--r) 0; overflow-wrap: anywhere; }
table.pb-wrap td, table.pb-wrap th { white-space: normal; }
table.pb-wrap td.n { white-space: nowrap; }
