/* daredemo-tsuen tool styles (loaded after base.css). No inline styles (CSP). Mobile first:
   the 事業 switch, 類型, 年齢別の人数 and 「いまの結果」 fit the first 375×812 screen. */

[hidden] { display: none !important; }
h1 { font-size: 1.2rem; 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); }
.intro { display: none; }
/* h1 の下の1行: 基準と、このツールで分かること(スマホでも出す。REVIEW_ux 4) */
.std-line { font-size: 0.8rem; line-height: 1.45; margin: 0 0 var(--space-2); }
.verified-text { display: none; }
.breadcrumb { font-size: 0.8rem; }
#tool-form fieldset { min-width: 0; }
#tool-form > fieldset, #tool-form > details { margin-bottom: var(--space-2); }
.label-sub, .legend-sub { display: block; font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.legend-sub { display: inline; }
.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; }
.save-line { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
select { max-width: 100%; }
input, select { min-width: 0; }

/* 事業の切替: 大きな2択のセグメント */
.program-switch { display: grid; grid-template-columns: 1fr 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 input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0.25rem 0.5rem; font-weight: 700; color: var(--accent); text-align: center; }
.seg input:checked + span { background: var(--accent); color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -5px; }

/* 類型: チップ */
.kind-set { border: 0; padding: 0; margin: 0; }
.kind-legend { font-weight: 700; font-size: 0.85rem; padding: 0; margin-bottom: 0.15rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip { position: relative; margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 0.45rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.chip input:checked + span { border: 2px solid var(--accent); color: var(--accent); background: var(--mark-bg); }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.kind-desc { margin: 0.25rem 0 0; font-size: 0.8rem; line-height: 1.4; }

/* 年齢別の人数 */
.count-set, .sub-set { border: 0; padding: 0; margin: 0; }
.count-set legend, .sub-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; }

.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; }
.wide-grid { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.pair-grid .field { margin-bottom: var(--space-2); min-width: 0; }
.pair-grid input[type="text"] { width: 100%; max-width: 12rem; 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; }

/* いまの結果 */
.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 { 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; }
details.hint-more summary { cursor: pointer; font-size: 0.85rem; color: var(--accent); min-height: 2.25rem; display: flex; align-items: center; }
#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)); }
}

/* ---------- 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} を表だけ戻す。REVIEW_ux 1)。
   数・見出しは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; }
.card-block.is-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; }
.formula { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.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 td.strong { font-weight: 700; }
.result-table tr.is-selected { background: var(--mark-bg); }
.result-table tr.is-selected th { color: var(--mark-text); }
.caution { font-weight: 600; }
.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); }
.caution-text { color: var(--mark-text); background: var(--mark-bg); padding: var(--space-1) var(--space-2); border-radius: 4px; }
.note-side { color: var(--text-muted); border-left: 3px solid var(--border); padding-left: var(--space-2); }
.link-list { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.link-list .btn { white-space: normal; text-align: left; }
.error-list ul { padding-left: 1.2em; }
.rule-table th[scope="row"] { font-weight: 600; }

/* 印刷: 結果が長いので、結果全体ではなくカード・表ごとに改ページを避ける(REVIEW_ux 15) */
.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; }
}
