/* ── box_ribbon_inverse3_3（箱にまくリボンの長さをぎゃくから考えよう、単元仕様書 v1.4）── */
/* 画面：問題文、箱とリボンの図（辺の名前と値は図の外）又は4つの経路図、注記、回答欄（数の欄・単位）、案内、共通のテンキー。回答後は正誤・正しい答え・解説（§5-3・§7） */
#question-text .brb-q{display:block;overflow-wrap:normal}
.brb-nb{white-space:nowrap}
.brb-phrase-group{display:inline;min-width:0}
.brb-main{margin:4px 0 6px;max-width:100%;display:flex;flex-direction:column;align-items:center;gap:8px}
/* 箱の図：左に高さ、下に長さ、右にはば。箱の形はどの問題でも同じ（確定表 BRB-05） */
.brb-fig{--brb-w:min(200px,52vw);display:grid;grid-template-columns:auto var(--brb-w) auto;grid-template-rows:auto auto;justify-content:center;max-width:100%;color:#111827;font-weight:700;background:#fff}
.brb-svg{display:block}
.brb-fig>.brb-svg{grid-column:2;grid-row:1;width:var(--brb-w);height:calc(var(--brb-w)*122/170)}
.brb-fl{font-size:15px;line-height:1.35;white-space:nowrap}
.brb-fl-name,.brb-fl-val{display:block}
.brb-fl-h{grid-column:1;grid-row:1;display:flex;flex-direction:column;align-items:flex-end;justify-content:center;text-align:right;padding:calc(var(--brb-w)*35/170) 5px calc(var(--brb-w)*7/170) 0}
.brb-fl-w{grid-column:3;grid-row:1;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;text-align:left;padding:0 0 calc(var(--brb-w)*4/170) 3px}
.brb-fl-l{grid-column:2;grid-row:2;text-align:center;width:calc(var(--brb-w)*120/170);margin-left:calc(var(--brb-w)*5/170);padding-top:2px}
.brb-note{margin:0;font-size:14px;line-height:1.7;color:#334155;text-align:center;max-width:560px;overflow-wrap:normal;word-break:normal}
/* 4つの経路図（2×2） */
.brb-opts{display:grid;grid-template-columns:repeat(2,minmax(0,176px));gap:8px;justify-content:center;width:100%;max-width:368px}
.brb-opt{position:relative;box-sizing:border-box;min-height:48px;padding:3px 6px 4px;font-family:inherit;color:#111827;background:#fff;border:3px solid #64748b;border-radius:10px;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center}
.brb-opt .brb-svg{width:100%;max-width:150px;height:auto}
.brb-opt-letter{align-self:flex-start;font-size:1.15rem;font-weight:800;line-height:1.25}
.brb-opt.brb-chosen{border-color:#1d4ed8;background:#dbeafe;box-shadow:inset 0 0 0 2px #1d4ed8}
.brb-opt:disabled{cursor:default;opacity:1;color:#111827}
.brb-opt.brb-ok{border:3px solid #15803d;background:#dcfce7;box-shadow:none}
.brb-opt.brb-ng{border:3px dashed #b91c1c;background:#fff1f2;box-shadow:none}
.brb-opt.brb-right{border:3px double #15803d}
.brb-field{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.brb-unit{font-size:1.25rem;font-weight:800;color:#111827}
.brb-input{width:4.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}
.brb-input:disabled{background:#f8fafc;color:#111827;opacity:1;border-color:#94a3b8}
.brb-input.brb-ok,.brb-input.brb-ok:disabled{border:3px solid #15803d;background:#dcfce7}
.brb-input.brb-ng,.brb-input.brb-ng:disabled{border:3px dashed #b91c1c;background:#fff1f2}
.brb-input.brb-bad{border:3px dashed #b45309;background:#fffbeb}
.brb-guide{margin:2px 0 0;font-size:16px;font-weight:700;text-align:center;max-width:560px;line-height:1.7}
.brb-guide[hidden]{display:none}
.brb-msg{min-height:1.4em;margin:2px 0;color:#b45309;font-weight:700;text-align:center;line-height:1.6;max-width:560px}
.brb-msg:empty{min-height:0;margin:0}
.brb-msg-line{display:block}
.brb-main .ufk-keypad{margin-top:4px}
.feedback.has-text.brb-feedback{height:auto;min-height:40px;padding:4px 0;text-align:center;line-height:1.45}
.brb-correct{margin:4px 0 6px;font-weight:800;font-size:17px;line-height:1.9}
.brb-expl-text{margin:4px 0 8px;line-height:2;overflow-wrap:normal;word-break:normal;line-break:strict}
.brb-example .brb-ex{margin:0 0 10px}
.brb-example .brb-ex-q{margin:6px 0 6px;font-weight:700;line-height:2}
.brb-example .brb-ex-a{margin:8px 0 8px;line-height:2}
.brb-example .brb-fig{--brb-w:min(180px,48vw)}
.brb-learning-focus{word-break:normal;line-break:strict}
/* 結果の一覧の図 */
.brb-list-q{display:block}
.brb-user-val{overflow-wrap:anywhere;word-break:break-all}
#page-result .brb-fig{--brb-w:min(130px,36vw);margin:4px auto 0}
#page-result .brb-fig .brb-fl{font-size:13px}
#page-result .brb-opts{grid-template-columns:repeat(2,minmax(0,110px));gap:4px;margin:4px auto 0}
#page-result .brb-opt{min-height:0;padding:1px 3px 2px;border-width:2px;cursor:default}
#page-result .brb-opt-letter{font-size:13px}
#page-quiz.active:has(.brb-main) #question-text{word-break:normal;overflow-wrap:normal;line-break:strict;font-size:17px;line-height:2}
#page-quiz.active:has(.brb-main) #hint-area .kp-card{display:flex;align-items:flex-start;gap:8px}
#page-quiz.active:has(.brb-main) #hint-area .kp-head{margin-bottom:0;flex:none}
#page-quiz.active:has(.brb-main) #hint-area .kp-title:empty{display:none}
#page-quiz.active:has(.brb-main) #hint-area .kp-body{flex:1;min-width:0;padding-left:0}
#page-quiz:has(#question-text[data-unit="box_ribbon_inverse3_3"]) .ufk-keypad{max-width:240px;width:100%}
#page-quiz:has(#question-text[data-unit="box_ribbon_inverse3_3"]) .ufk-keypad .num-btn{font-family:var(--font-ui)}
/* 結果画面の単元名：狭い幅でも省略せず、文節で折り返す */
.result-unit-badge.brb-badge{max-width:100%;white-space:normal;overflow:visible;text-overflow:clip;height:auto;border-radius:14px;line-height:1.5}
.result-unit-badge.brb-badge .rub-name{white-space:normal;overflow:visible;text-overflow:clip}
@media (max-width:400px){
  #page-lesson:has(.brb-example) .lesson-point,#page-lesson:has(.brb-example) .lesson-point *{font-size:15px}
  #page-lesson:has(.brb-example) .lesson-point{padding-left:10px;padding-right:10px;gap:6px}
  #page-lesson:has(.brb-example) .lesson-point .pt-icon{display:none}
  #page-lesson .lesson-example:has(.brb-example){padding-left:8px;padding-right:8px}
  #page-lesson .lesson-example div:has(>.brb-example){padding-left:6px!important;padding-right:6px!important}
  .brb-example .brb-ex-q,.brb-example .brb-ex-a{font-size:14px}
  .brb-guide,.brb-msg{font-size:15px}
  .brb-fl{font-size:14px}
  .brb-example .brb-fig{--brb-w:min(150px,34vw)}
  .brb-note{font-size:13px}
  .result-unit-badge.brb-badge,.result-unit-badge.brb-badge .rub-name,.result-unit-badge.brb-badge .brb-phrase{font-size:12px}
}
@media (max-width:340px){
  .brb-example .brb-ex-q,.brb-example .brb-ex-a{font-size:13px}
  #page-lesson:has(.brb-example) :is(h1,h2,h3):has(.brb-phrase){font-size:20px!important}
  .brb-opts{gap:6px;width:calc(100% + 24px);margin-left:-12px;margin-right:-12px}
  .brb-example .brb-fig{--brb-w:84px}
  .brb-example .brb-fl{font-size:12.5px}
}

/* 印刷（プリント共通仕様書のひな型P・P-標準：A4縦・2列×5行・1ページ。§7・確定表 BRB-08） */
.brb-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}
.brb-pr-headrow{flex:none;display:flex;flex-direction:column;gap:0}
.brb-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}
.brb-pr-headrow .pp-fields{margin:1mm 0 0}
.brb-pr-headrow .pp-field-name .pp-field-line{min-width:40mm}
.brb-pr-headrow hr.pp-fields-solid{flex:none;width:100%;margin:1.5mm 0 1.5mm!important}
.brb-pr-inst{flex:none;font-size:12.5pt;line-height:5.4mm;margin:0 0 1mm;padding:0 1mm;overflow-wrap:normal;word-break:normal}
.brb-pr-problems{flex:1 1 0;min-height:0;display:flex;gap:4mm;justify-content:center}
.brb-pr-col{width:93mm;display:flex;flex-direction:column;gap:1mm;min-height:0}
.brb-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}
.brb-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}
.brb-pr-no{flex:none;margin-right:1.6mm;font-weight:700;min-width:7.5mm;white-space:nowrap}
.brb-pr-qtext{flex:1 1 0;min-width:0}
.brb-pr-body{flex:1 1 0;min-height:0;display:flex;gap:2mm;margin-top:0.6mm}
.brb-fig.brb-fig-print{--brb-w:28mm;flex:none;align-self:flex-start;margin-left:2mm;font-weight:400;color:#000}
.brb-fig-print .brb-fl{font-size:9.5pt;line-height:4.1mm}
.brb-fig-print .brb-fl-h{padding-right:1mm}
.brb-fig-print .brb-fl-w{padding-left:0.6mm}
.brb-fig-print .brb-fl-l{padding-top:0.3mm}
.brb-pr-side{flex:1 1 0;min-width:0;display:flex;flex-direction:column}
.brb-pr-work{flex:1 1 0;min-height:10mm}
.brb-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}
.brb-pr-lead{flex:none;font-size:12.5pt;white-space:pre}
.brb-pr-paren{font-size:14pt;font-weight:400}
.brb-pr-blank{flex:none;display:inline-block;width:13.4mm;height:8.2mm}
.brb-pr-paren+.brb-pr-lead{margin-left:0.4mm}
.brb-pr-lead+.brb-pr-paren{margin-left:1.2mm}
.brb-pr-lead-en+.brb-pr-paren{margin-left:.3em}
.brb-pr-paren+.brb-pr-lead-en{margin-left:.25em}
.brb-pr-optrow{flex:none;display:flex;align-items:flex-end;justify-content:space-between;margin:0.8mm 0 0 0.6mm}
.brb-pr-opts{flex:none;display:flex;gap:1.4mm}
.brb-pr-opt{flex:none;width:18mm;display:flex;flex-direction:column}
.brb-pr-opt .brb-svg{width:18mm;height:calc(18mm*122/170)}
.brb-pr-letter{font-size:9.5pt;font-weight:700;line-height:3.7mm}
.brb-pr-ans-cr{height:7.8mm;line-height:7.8mm}
.brb-pr-ans-cr .brb-pr-blank{width:10.4mm;height:7.4mm}
.brb-pr-answers{flex:none;margin-top:1.5mm}
.brb-pr-fold{width:100%;height:0;border-top:2px dotted #333;margin:0 0 1.2mm}
.brb-pr-anshead{font-size:12.5pt;font-weight:700;line-height:6mm}
.brb-pr-acols{display:flex;gap:4mm}
.brb-pr-acol{width:93mm}
.brb-pr-answer{margin:0 0 0.5mm;font-size:10pt;line-height:4.4mm;white-space:nowrap}
#pr-sheet[data-unit="box_ribbon_inverse3_3"]{width:190mm;max-width:none;padding:0;margin:calc(12px + 10mm) auto;background:transparent;box-shadow:none}
#pr-sheet[data-unit="box_ribbon_inverse3_3"]>:not(#pr-problems){display:none!important}
#pr-sheet[data-unit="box_ribbon_inverse3_3"]>#pr-problems{display:block}
#pr-sheet[data-unit="box_ribbon_inverse3_3"] .brb-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="box_ribbon_inverse3_3"]{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="box_ribbon_inverse3_3"]>:not(#pr-problems){display:none!important}
  #page-print #pr-sheet[data-unit="box_ribbon_inverse3_3"]>#pr-problems{display:block!important}
  #page-print #pr-sheet[data-unit="box_ribbon_inverse3_3"] .brb-pr-page{display:flex!important;margin:0!important;box-shadow:none!important;break-after:auto;page-break-after:auto}
}
.brb-app-pdf-page .brb-pr-page{box-shadow:none;margin:0}
