/* © 2026 建築構造の備忘録（https://books-memorandum.com/）　無断転載・再配布を禁じます */
/* 断面性能計算ツール 画面・印刷 */
:root {
  --bg: #f6f3ec; --surface: #fff; --field: #f8f6f1; --text: #24282d; --muted: #6a6e74;
  --border: #e3ddd1; --accent: #0e6b5f; --accent-ink: #0a5a50; --accent-soft: #e2f1ec;
  --shadow: 0 1px 2px rgba(60,50,30,.06), 0 4px 16px rgba(60,50,30,.06);
  --warn-bg: #fff6e0; --warn-text: #7a5300; --error-bg: #fdecec; --error-text: #a12020;
  --steel: #c9d3dc; --steel-line: #56606b; --hole: #f6f3ec; --upper: rgba(243,201,105,.55);
  --axis: #9aa1ad; --centroid: #d03b3b; --hole-bg: #fbeaea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151816; --surface: #1e2220; --field: #262b28; --text: #e8e6e1; --muted: #a3a29c;
    --border: #333833; --accent: #4cbfa9; --accent-ink: #7fd8c6; --accent-soft: #1b3330;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --warn-bg: #3a2f14; --warn-text: #f2cf7a; --error-bg: #3d1d1d; --error-text: #ff9b9b;
    --steel: #3c4650; --steel-line: #b7c2cc; --hole: #151816; --upper: rgba(201,162,70,.45);
    --axis: #6b7381; --centroid: #e66767; --hole-bg: #2e1f1f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Yu Gothic UI", "Hiragino Sans", "Meiryo", system-ui, sans-serif; font-size: 14px; line-height: 1.6; }
html:not(.embedded) body { min-height: 100vh; }
.masthead { background: var(--surface); border-bottom: 1px solid var(--border); }
.mast-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.brand { font-weight: 700; font-size: 15px; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--accent); margin-right: 8px; }
.demo { font-size: 11px; font-weight: 700; color: var(--warn-text); background: var(--warn-bg); border-radius: 3px; padding: 1px 7px; }
.tagline { color: var(--muted); font-size: 12px; }
.credit { margin-left: auto; font-size: 12px; color: var(--accent-ink); }
.page { max-width: 1120px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 4px; }
.lead { margin: 0 0 14px; color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(0, 430px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px; }
.sec-h { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.sec-h .no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; flex: none; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.presets .lbl { font-size: 12px; color: var(--muted); width: 100%; }
.chip { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--field); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.part { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.part.hole { background: var(--hole-bg); }
.part-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 8px; }
.part-no { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 6px; background: var(--text); color: var(--surface); font-weight: 700; font-size: 12px; }
select { font: inherit; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--field); color: var(--text); }
.part-head .sp { flex: 1; }
.chk { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.icon-btn { border: 1px solid var(--border); background: var(--field); color: var(--muted); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 15px; line-height: 1; }
.icon-btn:hover { color: var(--error-text); border-color: var(--error-text); }
.std { margin-bottom: 8px; }
.std select { width: 100%; }
.scal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; padding: 6px 8px; border-radius: 6px; background: var(--field); }
.scal-r { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.scal-r input.num { width: 70px; }
.grid-in { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
.grid-in .f { display: grid; gap: 2px; }
.grid-in .f span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-in .f span b { color: var(--text); }
.pos { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
input.num { width: 100%; font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--field); color: var(--text); text-align: right; min-width: 0; }
input.num:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input.num.bad { border-color: var(--error-text); background: var(--error-bg); }
input.num:disabled { background: var(--border); color: var(--muted); border-color: transparent; cursor: not-allowed; opacity: 1; }
.btn { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent-ink); cursor: pointer; }
.btn:disabled { opacity: .4; cursor: default; }
.sub { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.sub-h { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.row-in { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 8px; align-items: center; }
.hint { color: var(--muted); font-size: 12px; }
.msgs { margin-top: 10px; }
.msg { border-radius: 6px; padding: 6px 10px; font-size: 12px; margin-top: 6px; }
.msg.warn { background: var(--warn-bg); color: var(--warn-text); }
.msg.error { background: var(--error-bg); color: var(--error-text); }
.figure { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; align-items: center; }
#fig { width: 100%; height: auto; max-height: 380px; display: block; }
.legend { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.kpis { display: grid; gap: 8px; }
.kpi { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; background: var(--field); }
.kpi.main { border-color: var(--accent); background: var(--accent-soft); }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi.main .v { color: var(--accent-ink); }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.kpi .v2 { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.steps h3 { font-size: 14px; margin: 16px 0 6px; }
.tbl-wrap { overflow-x: auto; }
table.calc { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
table.calc th, table.calc td { border-bottom: 1px solid var(--border); padding: 5px 8px; text-align: right; white-space: nowrap; }
table.calc th { color: var(--muted); font-weight: 400; background: var(--field); }
table.calc tr.neg td { color: var(--error-text); }
table.calc tr.sum td { font-weight: 700; border-top: 2px solid var(--text); }
.eq { font-family: "Cambria Math", "Times New Roman", serif; font-size: 15px; margin: 4px 0; overflow-x: auto; white-space: nowrap; }
.eq b { font-family: "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif; }
/* 結果のまとめ表 */
table.summary { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.summary th, table.summary td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.summary thead th { font-size: 11px; font-weight: 400; color: var(--muted); text-align: right; background: var(--field); }
table.summary thead th:first-child { text-align: left; }
table.summary tbody th { text-align: left; font-size: 12px; font-weight: 700; white-space: nowrap; }
table.summary td { text-align: right; font-size: 13px; line-height: 1.8; }
table.summary td.c { text-align: center; }
table.summary td b { font-size: 16px; }
table.summary tr.hl td, table.summary tr.hl th { background: var(--accent-soft); }
table.summary tr.hl td b { color: var(--accent-ink); font-size: 18px; }
table.summary tr.ph th { font-size: 11px; font-weight: 700; color: var(--accent-ink); text-align: left; padding: 8px 8px 2px; border-bottom: 0; }
table.summary tr.pr th { font-weight: 400; padding-left: 16px; }
table.summary .sym { color: var(--muted); font-size: 12px; margin-right: 6px; }
table.summary small { color: var(--muted); font-size: 11px; margin-left: 3px; }
table.summary .sm, table.calc .sm, .fx .sm { display: block; font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.4; }
/* 途中計算 */
.steps-h { font-size: 15px; margin: 20px 0 8px; }
.step { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; background: var(--surface); }
.step summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; background: var(--field); border-radius: 8px; }
.step[open] summary { border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.step summary::-webkit-details-marker { display: none; }
.step summary::after { content: "▾"; color: var(--muted); margin-left: 4px; transition: transform .15s; }
.step:not([open]) summary::after { transform: rotate(-90deg); }
.sn { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.st { font-weight: 700; font-size: 13px; }
.sr { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sb { padding: 10px 12px 12px; }
.fx { font-size: 12.5px; background: var(--field); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; padding: 6px 10px; margin-bottom: 10px; line-height: 1.7; }
table.calc { font-size: 12.5px; }
table.calc thead th { vertical-align: bottom; line-height: 1.3; padding: 6px 8px; }
table.calc th .u { display: block; font-size: 10px; color: var(--muted); }
table.calc tbody tr:nth-child(even):not(.sum) td { background: color-mix(in srgb, var(--field) 60%, transparent); }
table.calc td.pm { text-align: left; white-space: normal; min-width: 150px; }
table.calc td.pm .pno { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 5px; background: var(--text); color: var(--surface); font-size: 11px; font-weight: 700; margin-right: 8px; vertical-align: top; }
table.calc td.pm .pno.neg { background: var(--error-text); }
table.calc td.pm .pn { display: inline-block; vertical-align: top; }
table.calc tr.sum td { background: var(--accent-soft); color: var(--accent-ink); }
table.calc td:first-child, table.calc th:first-child { text-align: left; }
.res { margin-top: 10px; display: grid; gap: 4px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.res > div { overflow-x: auto; white-space: nowrap; }
.res b { color: var(--accent-ink); }
.res .rh { font-size: 12px; font-weight: 700; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 4px 20px; }
.grid2 .res { margin-top: 0; }
.note { font-size: 12px; color: var(--muted); margin-top: 12px; padding-left: 18px; }
.note li { margin: 2px 0; }
/* 印刷ボタン */
.sec-h .print-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 12px; }
.print-head { display: none; }

/* ---- 印刷（A4縦1枚）
   印刷の直前に html に printing クラスを付け、画面上で印刷用の配置にしてから高さを測り、1枚に収まるよう縮小する ---- */
@page { size: A4 portrait; margin: 10mm 11mm; }
@media print { * { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
html.printing {
  --bg: #fff; --surface: #fff; --field: #f6f6f4; --text: #111; --muted: #555; --border: #d8d8d8;
  --accent: #0e6b5f; --accent-ink: #0a5a50; --accent-soft: #e9f4f0; --steel: #d6dde3; --steel-line: #333;
  --hole: #fff; --axis: #888; --centroid: #c62828; --error-text: #a12020; --error-bg: #fdecec;
  color-scheme: light;
}
html.printing body { background: #fff; font-size: 12px; min-height: 0; }
html.printing .masthead, html.printing .lead, html.printing .page > h1, html.printing .layout > section:first-child,
html.printing .note, html.printing #out-h, html.printing .step summary::after { display: none !important; }
html.printing .page { width: 190mm; max-width: none; padding: 0; margin: 0; transform-origin: top left; }
html.printing .print-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 3px; margin-bottom: 8px; font-size: 12px; }
html.printing .print-head .ph-r { font-size: 10px; color: #555; white-space: nowrap; }
html.printing .layout { display: block; }
html.printing .panel { border: 0; box-shadow: none; padding: 0; background: #fff; }
html.printing .figure { grid-template-columns: 36% 1fr; gap: 12px; align-items: start; }
html.printing #fig { max-height: 230px; }
html.printing .legend { font-size: 10px; }
html.printing table.summary th, html.printing table.summary td { padding: 3px 6px; line-height: 1.5; }
html.printing table.summary td b { font-size: 13px; }
html.printing table.summary tr.hl td b { font-size: 14px; }
html.printing .steps-h { font-size: 13px; margin: 8px 0 4px; }
html.printing .step { break-inside: avoid; margin-bottom: 6px; }
html.printing .step summary { padding: 3px 8px; }
html.printing .st, html.printing .sr { font-size: 12px; }
html.printing .sb { padding: 4px 8px 6px; }
html.printing .fx { font-size: 10.5px; padding: 3px 8px; margin-bottom: 4px; }
html.printing table.calc { font-size: 10.5px; }
html.printing table.calc th, html.printing table.calc td { padding: 2px 6px; }
html.printing table.calc td.pm { min-width: 0; }
html.printing .res { font-size: 11.5px; margin-top: 4px; gap: 0; }
html.printing .tbl-wrap, html.printing .res > div { overflow: visible; }

/* ---- 印刷用の計算書（RC柱・露出柱脚ツールと同じ書式） ---- */
.sheet { display: none; }
html.printing .masthead, html.printing .page, html.printing .site-foot { display: none !important; }
/* ページの足（著作権表示） */
.site-foot { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12px; }
.site-foot .mast-in { justify-content: center; text-align: center; padding: 10px 16px; display: block; }
.site-foot a { color: var(--accent-ink); }
html.printing .sheet {
  display: block; width: 188mm; background: #fff; color: #111; font-size: 7.6pt; line-height: 1.22;
  font-family: "Yu Gothic", "YuGothic", "Meiryo", sans-serif; font-variant-numeric: tabular-nums;
  --ink: #111; --ink2: #555; --rule: #bbb; --rule2: #e2e2e2; --head: #1f3a5f;
}
.sheet table { border-collapse: collapse; }
.sheet .pd { display: flex; flex-direction: column; min-height: 265mm; }
.sheet .pd > .ps-footer { margin-top: auto; }
/* ページの頭と足 */
.sheet .ps-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.6pt solid var(--head); padding-bottom: 2pt; margin-bottom: 4mm; }
.sheet .ps-doc { font-size: 12pt; font-weight: 700; color: var(--head); letter-spacing: .08em; margin-right: 10pt; }
.sheet .ps-sub, .sheet .ps-date { color: var(--ink2); }
.sheet .ps-footer { display: flex; flex-wrap: wrap; gap: 0 12pt; border-top: .6pt solid var(--rule); padding-top: 2pt; margin-top: 3mm; color: var(--ink2); font-size: 6.6pt; }
.sheet .ps-credit { font-weight: 700; color: var(--head); }
/* カード */
.sheet .pc { border: .7pt solid var(--rule); border-left: 2.4pt solid var(--head); margin-bottom: 2.5mm; break-inside: avoid; }
.sheet .pc-head { display: flex; align-items: center; gap: 8pt; padding: 1.2pt 6pt; background: #f1f4f8; border-bottom: .5pt solid var(--rule); }
.sheet .pc-no { font-weight: 700; color: var(--head); }
.sheet .pc-title { font-weight: 700; font-size: 9pt; }
.sheet .pc-meta { color: var(--ink2); }
.sheet .pc-case { margin-left: auto; border: .6pt solid currentColor; border-radius: 2pt; padding: 0 4pt; font-weight: 700; color: #2a5ea8; }
.sheet .pc-body { display: grid; grid-template-columns: 52mm 1fr; gap: 0 4mm; padding: 2pt 6pt 3pt; align-items: start; }
.sheet .pc-figw { margin: 0; text-align: center; }
.sheet .pc-fig { width: 52mm; height: 52mm; display: block; }
.sheet .pc-figw figcaption { font-size: 6.4pt; color: var(--ink2); }
.sheet .pc-right { display: grid; gap: 2mm; align-content: start; }
.sheet .pc-spec, .sheet .pc-res { width: 100%; }
.sheet .pc-spec th, .sheet .pc-spec td, .sheet .pc-res th, .sheet .pc-res td { padding: .6pt 3pt; border-bottom: .4pt solid var(--rule2); white-space: nowrap; }
.sheet .pc-spec > thead th, .sheet .pc-res > thead th { color: var(--ink2); font-weight: 600; border-bottom: .7pt solid var(--rule); text-align: right; }
.sheet .pc-spec td { text-align: right; }
.sheet .pc-spec .l { text-align: left; }
.sheet .pc-spec td.l:last-child { white-space: normal; }
.sheet .pc-res > tbody > tr > th { text-align: left; font-weight: 600; }
.sheet .pc-res td { text-align: right; font-weight: 700; font-size: 8.4pt; }
.sheet .pc-res td.c { text-align: center; }
.sheet .pc-res tr.key td { color: var(--head); font-size: 9.4pt; }
.sheet .pc-res tr.key th, .sheet .pc-res tr.key td { background: #f1f4f8; }
.sheet .pc-res tr.sep th, .sheet .pc-res tr.sep td { border-top: .7pt solid var(--rule); }
.sheet small { color: var(--ink2); font-weight: normal; margin-left: 2pt; font-size: 6.4pt; }
.sheet .sb { color: var(--ink2); font-weight: normal; font-family: "Yu Gothic", sans-serif; }
/* 詳細（X軸・Y軸の2列） */
.sheet .pd-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; font-size: 6.8pt; line-height: 1.25; }
.sheet .pd-col h4 { margin: 0; padding: 1pt 4pt; background: var(--head); color: #fff; font-size: 7.4pt; }
.sheet .pd-col h5 { margin: 3pt 0 1pt; font-size: 7pt; color: var(--head); border-bottom: .6pt solid var(--head); }
.sheet .pd-wide { margin-top: 3mm; font-size: 6.8pt; }
.sheet .pd-tbl { width: 100%; }
.sheet .pd-tbl th, .sheet .pd-tbl td { padding: .3pt 2pt; border-bottom: .3pt solid var(--rule2); vertical-align: top; }
.sheet .pd-tbl th { text-align: left; white-space: nowrap; width: 10mm; font-weight: 700; }
.sheet .pd-tbl td { font-family: "Cambria Math", "Yu Gothic", serif; }
.sheet .pd-tbl td.v { text-align: right; white-space: nowrap; font-family: "Yu Gothic", sans-serif; font-weight: 700; width: 18mm; }
.sheet .pd-tbl tr.k-case td, .sheet .pd-tbl tr.k-case th { color: var(--head); font-weight: 700; font-family: "Yu Gothic", sans-serif; background: #f6f8fb; }
