/* ninkagai-hoiku tool styles (loaded after base.css). No inline styles (CSP). Mobile first:
   施設の区分・基準・年齢別の児童数・「いまの結果」 fit the first 375×812 screen. */

[hidden] { display: none !important; }
h1 { font-size: 1.15rem; line-height: 1.35; margin-bottom: var(--space-1); }
.verified { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 var(--space-2); }
.verified .badge { border-color: var(--ok); color: var(--ok); }
.verified-text { display: none; }
.intro { display: none; }
.std-line { font-size: 0.8rem; line-height: 1.45; margin: 0 0 var(--space-2); }
.breadcrumb { font-size: 0.8rem; }
#tool-form fieldset { min-width: 0; }
#tool-form > fieldset, #tool-form > details, #tool-form > .preset-row, #tool-form > .single-count { margin-bottom: var(--space-2); }
.legend-sub { display: inline; font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.choice { display: flex; align-items: center; gap: var(--space-2); font-weight: 400 !important; min-height: 2.75rem; }
.choice input { width: 1.2rem; height: 1.2rem; flex: none; }
.btn-link { font: inherit; background: none; border: 0; padding: 0.5rem 0; min-height: 2.75rem; color: var(--accent); text-decoration: underline; cursor: pointer; }
.btn-small { min-height: 2.5rem; padding: 0.25rem 0.75rem; font-size: 0.9rem; }
.save-line { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
select { max-width: 100%; }
input, select { min-width: 0; }

/* 施設の区分: 3択のセグメント */
.kind-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 2px solid var(--accent); border-radius: var(--radius); padding: 0; overflow: hidden; }
.seg { position: relative; display: block; margin: 0; cursor: pointer; }
.seg + .seg { border-left: 1px solid var(--accent); }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0.2rem 0.25rem; font-weight: 700; font-size: 0.9rem; line-height: 1.2; color: var(--accent); text-align: center; }
.seg small { font-size: 0.7rem; font-weight: 600; }
.seg input:checked + span { background: var(--accent); color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -5px; }

.preset-row { display: flex; align-items: center; gap: var(--space-2); }
.preset-row label { font-weight: 700; font-size: 0.85rem; flex: none; }
.preset-row select { flex: 1; min-height: 2.5rem; font-size: 0.85rem; }

/* 年齢別の人数 */
.count-set { border: 0; padding: 0; margin: 0; }
.count-set legend { font-weight: 700; font-size: 0.85rem; padding: 0; }
.count-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--space-2); align-items: end; }
.count-grid .field { margin-bottom: var(--space-1); min-width: 0; }
.count-grid label { font-size: 0.8rem; line-height: 1.25; }
.count-grid input { width: 100%; text-align: right; }
.single-count input { max-width: 8rem; text-align: right; }

.block { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); }
.block legend { font-weight: 700; padding: 0 var(--space-1); }
.pair-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0 var(--space-2); align-items: end; }
.pair-grid .field { margin-bottom: var(--space-2); min-width: 0; }
.pair-grid input { width: 100%; max-width: 12rem; text-align: right; }

/* 配置予定: 行 = 資格、列 = 常勤 / 短時間 */
.staff-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0.25rem var(--space-2); align-items: center; }
.staff-head { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.staff-name { font-size: 0.85rem; font-weight: 600; line-height: 1.3; }
.staff-name small { display: block; font-weight: 400; font-size: 0.7rem; color: var(--text-muted); }
.staff-grid .field { margin: 0; min-width: 0; }
.staff-grid input { width: 100%; text-align: right; }

details.options summary { cursor: pointer; font-weight: 600; min-height: 2.75rem; display: flex; align-items: center; gap: var(--space-1); }
#opt-changed { color: var(--mark-text); font-size: 0.85rem; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0 var(--space-3); }
.option-grid select { width: 100%; }
.ratio-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* いまの結果 */
.top-summary { border: 2px solid var(--accent); border-radius: var(--radius); padding: var(--space-1) var(--space-2); margin: var(--space-2) 0; background: var(--bg); }
.top-summary p { margin: 0; }
.top-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.quick-result { font-weight: 700; color: var(--accent); min-height: 1.5em; overflow-wrap: anywhere; font-size: 0.95rem; line-height: 1.45; }
.quick-result a.is-bad, .quick-result.is-bad { color: var(--danger); }
.top-cond { color: var(--text-muted); font-size: 0.75rem; line-height: 1.4; overflow-wrap: anywhere; }
.top-cond:empty { display: none; }
.example-tag { background: var(--mark-bg); color: var(--mark-text); padding: 0 0.25rem; border-radius: 4px; }
#prefill-status { margin-bottom: var(--space-1); }
@media (min-width: 48rem) {
  h1 { font-size: 1.6rem; }
  .intro { display: block; }
  .verified-text { display: inline; }
  .top-summary { position: sticky; top: 0; z-index: 3; box-shadow: 0 2px 8px rgb(0 0 0 / 0.12); }
  .count-grid { grid-template-columns: repeat(5, minmax(0, 8rem)); }
  .ratio-grid { grid-template-columns: repeat(4, minmax(0, 8rem)); }
  .staff-grid { grid-template-columns: 14rem 9rem 9rem; }
}

/* ---------- Results ---------- */
.results-heading { margin-top: var(--space-4); }
.summary-line { font-size: 0.9rem; color: var(--text-muted); overflow-wrap: anywhere; }
/* 表の中では数を途中で折らない(base.css の body{overflow-wrap:anywhere} を表だけ戻す。daredemo-tsuen と同じ)。
   数・見出しは1行、途中の式だけ語の切れ目で折る。狭いときは .table-scroll が横にスクロールする。 */
#results .tool-table { overflow-wrap: normal; word-break: keep-all; }
#results .tool-table th, #results .tool-table td.num { white-space: nowrap; }
#results .tool-table td.formula, #results .tool-table .wrap { white-space: normal; overflow-wrap: break-word; word-break: normal; min-width: 7rem; }
#results .tool-table caption { white-space: normal; text-align: left; }
.result-main { font-size: 1rem; overflow-wrap: anywhere; }
.result-main.is-bad { color: var(--danger); }
.example-label { display: inline-block; font-size: 0.875rem; font-weight: 600; background: var(--mark-bg); color: var(--mark-text); padding: 0 var(--space-2); border-radius: 4px; margin-bottom: var(--space-2); }
.result-block { margin: var(--space-3) 0; }
.result-block h3, .card-block h3 { margin-bottom: var(--space-1); }
.card-block { border: 2px solid var(--accent); border-radius: var(--radius); padding: var(--space-2) var(--space-3); margin: var(--space-3) 0; overflow-wrap: anywhere; }
/* 不足のときは枠だけ赤にし、数字・式はふつうの色のまま(✗ の行だけ赤。レビュー UX 6) */
.card-block.card-bad { border-color: var(--danger); }
.card-block p { margin: 0 0 var(--space-1); }
.big-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.big { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.big-text { font-size: 1.1rem; font-weight: 700; line-height: 1.4; }
.formula { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cite { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.check-list { list-style: none; padding: 0; margin: var(--space-1) 0; }
.is-ok { color: var(--ok); font-weight: 700; }
.is-bad { color: var(--danger); font-weight: 700; }
.result-table td.num, .result-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.result-table tr.is-selected { background: var(--mark-bg); }
.result-table tr.is-selected th { color: var(--mark-text); }
.def-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem var(--space-3); margin: var(--space-1) 0; }
.def-list dt { color: var(--text-muted); }
.def-list dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.note-list { padding-left: 1.2em; }
.note-list li { margin-bottom: var(--space-1); overflow-wrap: anywhere; }
.note-warn { color: var(--danger); }
.note-caution { color: var(--mark-text); background: var(--mark-bg); padding: 0 0.25rem; border-radius: 4px; }
.is-caution { color: var(--mark-text); background: var(--mark-bg); font-weight: 600; }
.link-list { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.link-list .btn { white-space: normal; text-align: left; }
details.ninka summary { cursor: pointer; font-weight: 700; min-height: 2.75rem; display: flex; align-items: center; }
.error-list ul { padding-left: 1.2em; }
.rule-table th[scope="row"] { font-weight: 600; }

.print-head { margin-bottom: var(--space-2); }
.print-title { font-weight: 700; font-size: 1.1rem; margin: 0 0 var(--space-1); }
@media print {
  .results { break-inside: auto; }
  .card-block, .result-table, .print-head { break-inside: avoid; }
  .results-heading { display: none; }
}

.badge-sel { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0 0.3rem; border-radius: 4px; background: var(--mark-text); color: var(--bg); white-space: nowrap; }
.cell-sub { display: block; font-size: 0.7rem; color: var(--text-muted); white-space: normal; text-align: right; } /* 語の切れ目(空白)で折る。数字は途中で折らない */
.ninka-line { font-weight: 700; margin: 0 0 var(--space-2); }
#countTotal-error:empty { display: none; }
/* 日本語の文を文節で折る(「1人」「第1-1(2)」を途中で折らない。対応しないブラウザでは通常の折り返し。レビュー UX 11) */
.card-block, .card-block .formula, .quick-result, .result-main, .summary-line, .ninka-line, .note-list li { overflow-wrap: break-word; word-break: auto-phrase; }
