/* ── connected_shape_material_formula3_4（つながる図形の部材数を式にしよう、単元仕様書 v1.5）── */
/* 画面：問題文、図の決まり、とちゅうの点をはぶいた図、回答欄（数の欄・単位、又は4つの式）、案内、共通のテンキー。回答後は正誤・正しい答え・解説（§5-3・§7） */
#question-text .csm-q{display:block;overflow-wrap:normal}
.csm-nb{white-space:nowrap}
.csm-phrase-group{display:inline;min-width:0}
.csm-main{margin:4px 0 6px;max-width:100%;display:flex;flex-direction:column;align-items:center;gap:8px}
/* 図：どの問題でも同じ形（とちゅうの点をはぶく）。まとまりの数は図の上に重ねた文字 */
.csm-def{margin:0;font-size:14px;color:#475569;line-height:1.7;text-align:center;max-width:560px}
.csm-list-q{display:block}
.csm-after{margin:0;font-size:15px;font-weight:800;color:#1e3a8a;line-height:1.6;text-align:center}
/* 4つの式：えらんだ式は太い実線、正しい式は二重線、誤りは点線（色だけに頼らない） */
.csm-opts{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;width:min(360px,100%)}
.csm-opt{display:flex;align-items:center;justify-content:center;gap:10px;min-height:52px;padding:6px 8px;border:2px solid #94a3b8;border-radius:12px;background:#fff;color:#111827;font-family:inherit;font-size:1.15rem;font-weight:800;cursor:pointer;white-space:nowrap}
.csm-opt-letter{flex:none;min-width:1.4em;text-align:center;color:#334155}
.csm-opt.csm-chosen{border:4px solid #1d4ed8;background:#eff6ff}
.csm-opt:disabled{cursor:default;color:#111827;opacity:1}
.csm-opt.csm-ok,.csm-opt.csm-ok:disabled{border:4px solid #15803d;background:#dcfce7}
.csm-opt.csm-ng,.csm-opt.csm-ng:disabled{border:4px dashed #b91c1c;background:#fff1f2}
.csm-opt.csm-right,.csm-opt.csm-right:disabled{border:6px double #15803d;background:#f0fdf4}
.csm-field{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.csm-unit{font-size:1.2rem;font-weight:800;color:#111827}
.csm-input{width:4em;min-height:48px;font-size:1.35rem;padding:0 6px;border:3px solid #1d4ed8;background:#eff6ff;border-radius:8px;text-align:center;font-family:inherit;font-weight:800;box-sizing:border-box}
.csm-input:disabled{background:#f8fafc;color:#111827;opacity:1;border-color:#94a3b8}
.csm-input.csm-ok,.csm-input.csm-ok:disabled{border:3px solid #15803d;background:#dcfce7}
.csm-input.csm-ng,.csm-input.csm-ng:disabled{border:3px dashed #b91c1c;background:#fff1f2}
.csm-input.csm-bad{border:3px dashed #b45309;background:#fffbeb}
.csm-guide{margin:2px 0 0;font-size:16px;font-weight:700;text-align:center;max-width:560px;line-height:1.7}
.csm-guide[hidden]{display:none}
.csm-msg{min-height:1.4em;margin:2px 0;color:#b45309;font-weight:700;text-align:center;line-height:1.6;max-width:560px}
.csm-msg:empty{min-height:0;margin:0}
.csm-msg-line{display:block}
.csm-main .ufk-keypad{margin-top:4px}
.feedback.has-text.csm-feedback{height:auto;min-height:40px;padding:4px 0;text-align:center;line-height:1.45}
.csm-correct{margin:4px 0 6px;font-weight:800;font-size:17px;line-height:1.9}
.csm-expl-text{margin:4px 0 8px;line-height:2;overflow-wrap:normal;word-break:normal;line-break:strict}
.csm-example{display:flex;flex-direction:column;align-items:center}
.csm-example .csm-ex-q{margin:6px 0 6px;font-weight:700;line-height:2;align-self:stretch}
.csm-example .csm-ex-a{margin:8px 0 8px;line-height:2;align-self:stretch}
.csm-learning-focus{word-break:normal;line-break:strict}
.csm-user-val{white-space:nowrap}
.csm-user-val.csm-user-long{white-space:normal;overflow-wrap:anywhere;word-break:break-all}
#page-quiz.active:has(.csm-main) #question-text{word-break:normal;overflow-wrap:normal;line-break:strict;font-size:17px;line-height:2}
#page-quiz.active:has(.csm-main) #hint-area .kp-card{display:flex;align-items:flex-start;gap:8px}
#page-quiz.active:has(.csm-main) #hint-area .kp-head{margin-bottom:0;flex:none}
#page-quiz.active:has(.csm-main) #hint-area .kp-title:empty{display:none}
#page-quiz.active:has(.csm-main) #hint-area .kp-body{flex:1;min-width:0;padding-left:0}
#page-quiz:has(#question-text[data-unit="connected_shape_material_formula3_4"]) .ufk-keypad{max-width:240px;width:100%}
#page-quiz:has(#question-text[data-unit="connected_shape_material_formula3_4"]) .ufk-keypad .num-btn{font-family:var(--font-ui)}
/* 結果画面の単元名：狭い幅でも省略せず、文節で折り返す */
.result-unit-badge.csm-badge{max-width:100%;white-space:normal;overflow:visible;text-overflow:clip;height:auto;border-radius:14px;line-height:1.5}
.result-unit-badge.csm-badge .rub-name{white-space:normal;overflow:visible;text-overflow:clip}
@media (max-width:400px){
  #page-lesson:has(.csm-example) .lesson-point,#page-lesson:has(.csm-example) .lesson-point *{font-size:15px}
  #page-lesson:has(.csm-example) .lesson-point{padding-left:10px;padding-right:10px;gap:6px}
  #page-lesson:has(.csm-example) .lesson-point .pt-icon{display:none}
  #page-lesson .lesson-example:has(.csm-example){padding-left:8px;padding-right:8px}
  #page-lesson .lesson-example div:has(>.csm-example){padding-left:6px!important;padding-right:6px!important}
  .csm-example .csm-ex-q,.csm-example .csm-ex-a{font-size:14px}
  .csm-guide,.csm-msg{font-size:15px}
  .csm-def{font-size:13px}
  .csm-opt{font-size:1.05rem;gap:6px;padding:6px 4px}
  .result-unit-badge.csm-badge,.result-unit-badge.csm-badge .rub-name,.result-unit-badge.csm-badge .csm-phrase{font-size:12px}
}
@media (max-width:340px){
  .csm-example .csm-ex-q,.csm-example .csm-ex-a{font-size:13px}
  #page-lesson:has(.csm-example) :is(h1,h2,h3):has(.csm-phrase){font-size:20px!important}
  #page-lesson .lesson-card:has(.csm-example){padding-left:12px;padding-right:12px}
  #page-lesson .lesson-example:has(.csm-example){padding-left:4px;padding-right:4px}
  #page-lesson .lesson-example div:has(>.csm-example){padding-left:2px!important;padding-right:2px!important}
}

/* 印刷（プリント共通仕様書のひな型P・P-標準：A4縦・2列×5行・1ページ。§7・確定表 CSM-08） */
.csm-pr-page{width:190mm;height:276mm;box-sizing:border-box;color:#000;background:#fff;font-family:'Atkinson Hyperlegible','BIZ UDPGothic','Yu Gothic','Meiryo',sans-serif;display:flex;flex-direction:column;overflow:hidden}
.csm-pr-headrow{flex:none;display:flex;flex-direction:column;gap:0}
.csm-pr-title{box-sizing:border-box;width:100%;height:9mm;margin:0;padding:0 2mm;border:1.5pt solid #666;background:#ffffcc;font-size:13pt;line-height:calc(9mm - 3pt);text-align:center;font-weight:700;white-space:nowrap;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.csm-pr-headrow .pp-fields{margin:1mm 0 0}
.csm-pr-headrow .pp-field-name .pp-field-line{min-width:40mm}
.csm-pr-headrow hr.pp-fields-solid{flex:none;width:100%;margin:1.5mm 0 1.5mm!important}
.csm-pr-problems{flex:1 1 0;min-height:0;display:flex;gap:4mm;justify-content:center}
.csm-pr-col{width:93mm;display:flex;flex-direction:column;gap:1mm;min-height:0}
.csm-pr-cell{box-sizing:border-box;width:93mm;flex:1 1 0;min-height:0;padding:0 0.5mm;overflow:hidden;break-inside:avoid;display:flex;flex-direction:column}
.csm-pr-q{flex:none;display:flex;align-items:flex-start;margin:0;font-size:12.5pt;line-height:5.4mm;overflow-wrap:normal;word-break:normal}
.csm-pr-no{flex:none;margin-right:1.6mm;font-weight:700;min-width:7.5mm;white-space:nowrap}
.csm-pr-qtext{flex:1 1 0;min-width:0}
.csm-pr-letter{margin-right:1.2mm}
.csm-pr-no{min-width:9.6mm!important}
.csm-pr-work{flex:1 1 0;min-height:5mm}
.csm-pr-ansrow{flex:none;display:flex;align-items:center;justify-content:flex-end;height:8.6mm;font-size:12.5pt;line-height:8.6mm;white-space:nowrap}
.csm-pr-lead{flex:none;font-size:12.5pt;white-space:pre}
.csm-pr-paren{font-size:14pt;font-weight:400}
.csm-pr-blank{flex:none;display:inline-block;width:12.4mm;height:8.2mm}
.csm-pr-paren+.csm-pr-lead{margin-left:0.4mm}
.csm-pr-lead+.csm-pr-paren{margin-left:1.2mm}
.csm-pr-lead-en+.csm-pr-paren{margin-left:.3em}
.csm-pr-paren+.csm-pr-lead-en{margin-left:.25em}
.csm-pr-answers{flex:none;margin-top:1.5mm}
.csm-pr-fold{width:100%;height:0;border-top:2px dotted #333;margin:0 0 1.2mm}
.csm-pr-anshead{font-size:12.5pt;font-weight:700;line-height:6mm}
.csm-pr-acols{display:flex;gap:4mm}
.csm-pr-acol{width:93mm}
.csm-pr-answer{margin:0 0 0.5mm;font-size:10pt;line-height:4.4mm;white-space:nowrap}
#pr-sheet[data-unit="connected_shape_material_formula3_4"]{width:190mm;max-width:none;padding:0;margin:calc(12px + 10mm) auto;background:transparent;box-shadow:none}
#pr-sheet[data-unit="connected_shape_material_formula3_4"]>:not(#pr-problems){display:none!important}
#pr-sheet[data-unit="connected_shape_material_formula3_4"]>#pr-problems{display:block}
#pr-sheet[data-unit="connected_shape_material_formula3_4"] .csm-pr-page{box-shadow:0 0 0 10mm #fff,0 0 4px 10mm rgba(0,0,0,.12);margin-bottom:calc(8mm + 10mm)}
@media print{
  #page-print #pr-sheet[data-unit="connected_shape_material_formula3_4"]{width:auto!important;max-width:none!important;margin:0!important;padding:0!important;transform:none!important;box-shadow:none!important}
  #page-print #pr-sheet[data-unit="connected_shape_material_formula3_4"]>:not(#pr-problems){display:none!important}
  #page-print #pr-sheet[data-unit="connected_shape_material_formula3_4"]>#pr-problems{display:block!important}
  #page-print #pr-sheet[data-unit="connected_shape_material_formula3_4"] .csm-pr-page{display:flex!important;margin:0!important;box-shadow:none!important;break-after:auto;page-break-after:auto}
}
.csm-app-pdf-page .csm-pr-page{box-shadow:none;margin:0}

/* ── 図：はじめの3こだけをつないだ図。番号は図形のまん中。共有する辺は点線 ── */
.csm-fig{color:#111827;font-weight:800;flex:none;display:flex;flex-direction:column;align-items:center}
.csm-fig-screen{width:min(calc(var(--csm-w) * 1.2px),100%)}
.csm-fig-in{position:relative;width:100%}
.csm-svg{position:absolute;inset:0;width:100%;height:100%;display:block;overflow:visible}
.csm-fn{position:absolute;transform:translate(-50%,-50%);font-size:14px;line-height:1;white-space:nowrap}
.csm-fname{display:block;font-size:13px;font-weight:700;color:#334155;line-height:1.3;white-space:nowrap}
.csm-after{margin:0;font-size:.95rem;font-weight:700;color:#334155;text-align:center;overflow-wrap:normal;word-break:normal}
/* ── B群の表 ── */
.csm-table{border-collapse:collapse;font-size:1rem;font-weight:700;color:#111827;background:#fff;max-width:100%}
.csm-table th,.csm-table td{border:2px solid #475569;padding:6px 8px;line-height:1.35}
.csm-table th{text-align:left;background:#f1f5f9;overflow-wrap:normal;word-break:normal}
.csm-table td{text-align:center;min-width:34px;white-space:nowrap}
/* ── 紙面：共通の案内と、その下の4つの図 ── */
.csm-pr-common{flex:none;display:flex;flex-direction:column;gap:1mm;margin:0 0 1.5mm;padding:0 1mm}
.csm-pr-inst{flex:none;font-size:12.5pt;line-height:5.4mm;margin:0;overflow-wrap:normal;word-break:normal}
.csm-pr-figs{flex:none;display:flex;justify-content:space-around;align-items:flex-end;gap:4mm}
.csm-fig.csm-fig-print{font-weight:700;color:#000;flex:none}
.csm-fig-print .csm-fig-in{height:13mm;width:auto}
.csm-fig-print .csm-fn{font-size:9pt;color:#000}
.csm-fig-print .csm-fname{font-size:9pt;color:#000;line-height:4mm}
.csm-pr-optrow{flex:none;display:flex;align-items:flex-end;justify-content:space-between;gap:0.5mm;margin:0.6mm 0 0}
.csm-pr-optrow .csm-pr-ansrow{flex:none}
.csm-pr-opts{flex:none;display:grid;grid-template-columns:auto auto;justify-content:start;column-gap:2.5mm;row-gap:0.4mm;margin:0;font-size:12.5pt;line-height:5.4mm;white-space:nowrap}
.csm-pr-cell[data-csm-type="B1"] .csm-pr-work,.csm-pr-cell[data-csm-type="B2"] .csm-pr-work{min-height:0}
/* せまい画面：4つの式のボタンを問題の枠におさめる（確定表 CSM-14） */
@media (max-width:360px){
  .csm-opts{gap:6px}
  .csm-opt{font-size:14px;gap:3px;padding:6px 2px}
  .csm-opt-letter{min-width:1.15em}
}
