/* 教科書補助(/hojo/)。色と書体は style.css の :root の変数を使う */
.hj { max-width: 760px; padding-top: 18px; padding-bottom: 64px; }
.hj-meta { font-size: 14px; color: var(--muted); }
.hj-kind { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--green); border: 1.5px solid var(--green); border-radius: 4px; padding: 0 8px; margin-right: 8px; }
.hj h1 { font-size: clamp(24px, 4.6vw, 32px); color: var(--green); text-wrap: balance; margin: 8px 0 4px; }
.hj h2 { font-size: 22px; color: var(--green); border-bottom: 2px solid var(--green); padding-bottom: 6px; margin: 0 0 14px; text-wrap: balance; }
.hj p { margin: 0 0 14px; }
.hj-body section, .hj > section { margin-top: 40px; }
.hj rt { font-size: .55em; color: var(--muted); }
.hj-points { background: var(--band); border-radius: 10px; padding: 16px 20px; margin-top: 20px; }
.hj-points .lbl { font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--green); }
.hj-points ol { list-style: decimal; padding-left: 1.4em; margin: 6px 0 0; }
.hj-points li { margin: 4px 0; }
.hj-q { border: 2px solid var(--green); border-radius: 10px; padding: 14px 20px; margin-top: 20px; }
.hj-q .lbl, .hj-ans .lbl { display: inline-block; background: var(--green); color: #fff; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 4px; letter-spacing: .06em; }
.hj-q p { font-size: 19px; font-weight: 700; margin: 10px 0 4px; }
.hj-q small { color: var(--muted); }
.hj-flow { list-style: none; margin: 0 0 16px 6px; padding: 0; border-left: 3px solid var(--line); }
.hj-flow li { position: relative; padding: 4px 0 14px 22px; }
.hj-flow li::before { content: ""; position: absolute; left: -8px; top: 12px; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 3px solid var(--green); }
.hj-flow .y { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--green); margin-right: 8px; }
.hj-why { background: var(--band); border-radius: 8px; padding: 12px 16px; margin: 10px 0 16px; }
.hj-why b { color: var(--green); }
.hj-tatoe { border-left: 4px solid var(--yellow); padding: 6px 0 6px 14px; margin: 10px 0 16px; }
.hj-tatoe b { display: block; font-size: 13px; letter-spacing: .06em; }
.hj-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 16px; }
.hj-pair > div { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.hj-pair .h { font-weight: 700; color: var(--green); }
.hj-tbl { overflow-x: auto; margin-bottom: 12px; }
.hj table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.6; }
.hj th, .hj td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
.hj th { background: var(--band); white-space: nowrap; }
.hj-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.hj-person { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; }
.hj-person .ph { flex: 0 0 96px; width: 96px; height: 120px; object-fit: cover; object-position: center top; border-radius: 6px; background: var(--band); }
.hj-person .ph-none { display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; color: var(--green); opacity: .55; }
.hj-person .tx { min-width: 0; }
.hj-person .n { font-weight: 700; font-size: 17px; }
.hj-person .d { font-size: 14.5px; line-height: 1.7; color: var(--muted); }
.hj-person .cr { font-size: 11.5px; line-height: 1.5; color: var(--muted); margin-top: 6px; }
/* 画像(本文の <div class="hj-fig" data-fig="…">)。出典は画像のすぐ下に必ず出す */
.hj-fig { margin: 14px 0 18px; }
.hj-fig img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; background: var(--band); border-radius: 8px; }
.hj-fig figcaption { margin-top: 6px; font-size: 14.5px; line-height: 1.6; }
.hj-fig .cap { display: block; }
.hj-fig .t, .hj-fig .cr { display: block; font-size: 12.5px; color: var(--muted); }
.hj-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 18px; }
.hj-figs .hj-fig { margin: 0; min-width: 0; }
.hj-figs .hj-fig img { aspect-ratio: 4 / 3; object-fit: cover; }
@media (max-width: 480px) { .hj-figs { grid-template-columns: 1fr; } .hj-figs .hj-fig img { aspect-ratio: auto; object-fit: contain; } }
.hj-src-h { font-weight: 700; margin: 14px 0 4px; }
.hj-miss { display: flex; flex-direction: column; gap: 12px; }
.hj-miss div { background: #fbefe8; border-radius: 8px; padding: 12px 16px; }
.hj-miss .x { color: var(--cta); font-weight: 700; }
.hj-miss .o { font-weight: 700; }
.hj-quiz { display: flex; flex-direction: column; gap: 10px; counter-reset: qz; }
.hj-quiz details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.hj-quiz summary { cursor: pointer; font-weight: 700; list-style: none; counter-increment: qz; }
.hj-quiz summary::before { content: counter(qz) ". "; color: var(--green); }
.hj-quiz summary::-webkit-details-marker { display: none; }
.hj-quiz .hint { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.hj-quiz details[open] summary { margin-bottom: 6px; }
.hj-quiz .a { color: var(--green); font-weight: 700; }
.hj-ans { border: 2px solid var(--green); border-radius: 10px; padding: 14px 20px; }
.hj-ans p { margin: 8px 0 0; }
.hj-cta { display: block; text-align: center; background: var(--cta); color: #fff; text-decoration: none; font-weight: 700; padding: 14px 16px; border-radius: 8px; }
.hj-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.hj-pn > * { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 15px; min-width: 0; color: var(--ink); text-decoration: none; }
.hj-pn small { display: block; color: var(--muted); font-size: 12px; }
.hj-pn .soon { color: var(--muted); }
.hj-tb li { margin: 4px 0; }
.hj-tbline { font-size: 14px; color: var(--muted); margin: 6px 0 0; line-height: 1.6; }
.hj-tb-lessons li { margin: 4px 0; }
.hj-src li { font-size: 14px; margin: 4px 0; }
.hj-draft { background: #fff6d6; border: 1px solid var(--yellow); border-radius: 6px; padding: 8px 12px; font-size: 13px; margin-top: 12px; }
@media (max-width: 560px) { .hj-pair, .hj-pn { grid-template-columns: 1fr; } }

/* 傍論(最新の研究・別の見方)。赤枠で、本文と区別する */
.boron { border: 2.5px solid var(--red); border-radius: 10px; padding: 14px 18px 4px; margin: 18px 0; background: #fff; }
.boron-h { font-weight: 700; color: var(--red); font-size: 16.5px; }
.boron-h::before { content: "傍論"; display: inline-block; background: var(--red); color: #fff; font-size: 12px; padding: 1px 8px; border-radius: 4px; margin-right: 8px; letter-spacing: .1em; vertical-align: 2px; }
.boron-test { font-weight: 700; font-size: 14.5px; }
.boron-src { font-size: 13px; color: var(--muted); }

/* 用語:本文中は点線、タップで画面の下にカードが出る */
.term { all: unset; cursor: pointer; color: var(--link); border-bottom: 2px dotted var(--link); line-height: 1.2; }
.term:hover { background: var(--band); }
.term:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.term[aria-expanded="true"] { background: var(--yellow); color: var(--ink); border-bottom-color: transparent; }
.hj-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
.hj-sheet[hidden] { display: none; }
.hj-sheet-card { width: 100%; max-width: 560px; background: #fff; border: 2px solid var(--green); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 6px; }
.hj-sheet-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hj-sheet-word { font-family: var(--round); font-weight: 700; font-size: 22px; color: var(--green); }
.hj-sheet-yomi { font-size: 14px; color: var(--muted); }
.hj-sheet-close { all: unset; cursor: pointer; margin-left: auto; font-size: 14px; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.hj-sheet-close:focus-visible { outline: 3px solid var(--ink); }
.hj-sheet-def { margin: 0; line-height: 1.8; }
.hj-sheet-meta { font-size: 13px; color: var(--muted); }
.hj-sheet-more { font-weight: 700; align-self: flex-start; }

/* 単元ページから教科書補助へのボタン */
.hj-unit-link { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hj-unit-link a { display: inline-block; padding: 6px 12px; border: 2px solid var(--green); border-radius: 999px; color: var(--green); font-weight: 700; text-decoration: none; font-size: 14px; }
.hj-unit-link a:hover { background: var(--band); }

/* 地図(本文の場所と連動)。外部の地図サービスは使わず、都道府県の境界から描いた SVG */
.hj-mapbox { margin: 18px 0 20px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 8px; }
.hj-map-h { font-weight: 700; color: var(--green); margin-bottom: 8px; }
.hj-map-svg { overflow-x: auto; border-radius: 8px; }
.hj-map-svg svg { display: block; width: 100%; height: auto; min-width: 320px; }
.hj-mapbox .sea { fill: #eef5fa; }
.hj-mapbox .land { fill: #f4f1e6; stroke: #b9b39c; stroke-width: .7; stroke-linejoin: round; }
.hj-pin { cursor: pointer; outline: none; }
.hj-pin .hit { fill: transparent; }
.hj-pin .dot { fill: var(--g4); stroke: #fff; stroke-width: 2.5; transition: r .15s; }
.hj-pin.battle .dot { fill: var(--red); }
.hj-pin text { font: 700 21px var(--body); fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.hj-pin.on .dot { r: 12; stroke: var(--yellow); stroke-width: 4; }
.hj-pin:focus-visible .hit { stroke: var(--ink); stroke-width: 2.5; }
.hj-map-info { margin: 8px 0; padding: 8px 12px; background: var(--band); border-radius: 8px; font-size: 15px; min-height: 2.4em; }
.hj-map-info b { color: var(--green); }
.hj-map-info .go { all: unset; cursor: pointer; color: var(--link); text-decoration: underline; font-size: 14px; margin-left: 6px; }
.hj-places { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; }
.hj-places li { font-size: 14.5px; line-height: 1.6; }
.hj-place { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline; margin-right: 6px; }
.hj-place b { color: var(--g4); border-bottom: 2px dotted currentColor; }
.hj-place.battle b { color: var(--red); }
.hj-place .year { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hj-place:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.hj-places .d { color: var(--muted); }
.hj-map-note { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.hj-sheet-map { all: unset; cursor: pointer; align-self: flex-start; font-weight: 700; color: var(--red); }
.hj-sheet-map:focus-visible { outline: 3px solid var(--ink); }
.term.flash { animation: hjflash 1.6s ease-out; }
@keyframes hjflash { 0%, 40% { background: var(--yellow); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .term.flash { animation: none; background: var(--yellow); } }

/* 動かせる地図(Leaflet + 地理院タイル) */
.hj-lmap { height: 380px; border-radius: 8px; overflow: hidden; background: #eef5fa; position: relative; z-index: 0; }
@media (max-width: 560px) { .hj-lmap { height: 320px; } }
.hj-lmap-wait { padding: 16px; color: var(--muted); font-size: 14px; }
.hj-lmap .leaflet-tooltip.hj-ltip { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 4px; box-shadow: none; font: 700 14px var(--body); color: var(--ink); padding: 1px 6px; }
.hj-lmap .leaflet-tooltip.hj-ltip.battle { color: var(--red); }
.hj-lmap .leaflet-tooltip.hj-ltip::before { display: none; }
.hj-lmap .hj-reset { background: #fff; border-radius: 4px; border: 2px solid rgba(0,0,0,.2); }
.hj-lmap .hj-reset button { all: unset; cursor: pointer; display: block; padding: 4px 8px; font: 700 13px var(--body); color: var(--ink); }
.hj-lmap .hj-reset button:focus-visible { outline: 3px solid var(--ink); }
.hj-lmap .leaflet-control-layers { font: 13px var(--body); }
.hj-place.on b { background: var(--yellow); }

/* 目次 */
.hj-toc { border: 1px solid var(--line); border-radius: 10px; padding: 12px 18px 10px; margin-top: 20px; background: #fff; }
.hj-toc-h { font-weight: 700; color: var(--green); margin: 0 0 4px; letter-spacing: .08em; }
.hj-toc ol { list-style: decimal; padding-left: 1.5em; margin: 0; }
.hj-toc li { margin: 3px 0; }
.hj-toc a { text-decoration: none; }
.hj-toc a:hover { text-decoration: underline; }
.hj h2[id], .hj section[id] { scroll-margin-top: 16px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* グラフ(build.py の hojo_chart_html が HTML だけで作る) */
.hj-chart { margin: 14px 0 18px; padding: 14px 16px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.hj-chart figcaption { font-weight: 700; color: var(--green); margin-bottom: 10px; }
.hj-chart figcaption small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.hj-bars { list-style: none; margin: 0; padding: 0; }
.hj-bars li { display: grid; grid-template-columns: 5.2em 1fr 3.4em; align-items: center; gap: 8px; padding: 3px 0; font-size: 15px; }
.hj-bars .l { white-space: nowrap; }
.hj-bars .b { height: 16px; }
.hj-bars .b i { display: block; height: 100%; background: #b9cdc2; border-radius: 0 4px 4px 0; }
.hj-bars .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.hj-bars .hl .b i { background: var(--green); }
.hj-bars .hl .l, .hj-bars .hl .v { font-weight: 700; color: var(--ink); }
.hj-cols { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 14px; height: 210px; align-items: end; max-width: 460px; }
.hj-cols li { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.hj-cols .b { width: 64%; max-width: 72px; min-height: 3px; background: #b9cdc2; border-radius: 4px 4px 0 0; }
.hj-cols .v { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; margin-bottom: 4px; white-space: nowrap; }
.hj-cols .v small { font-weight: 400; font-size: 12px; margin-left: 1px; }
.hj-cols .l { font-size: 13.5px; color: var(--muted); margin-top: 6px; text-align: center; border-top: 1px solid var(--line); width: 100%; padding-top: 4px; }
.hj-cols .hl .b { background: var(--green); }
.hj-chart-src { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; }
.boron .hj-chart { border-color: #f0d3d0; }

/* 寄り道(テストには出ないけれど、知ると面白い話。傍論=学説の話とは分ける) */
.yorimichi { border: 2.5px solid var(--yellow); border-radius: 10px; padding: 16px 18px 6px; margin: 22px 0; background: #fffbea; }
.yorimichi h2 { border: 0; color: var(--ink); font-size: 19px; padding: 0; margin: 0 0 10px; }
.yorimichi h2::before { content: "寄り道"; display: inline-block; background: var(--yellow); color: var(--ink); font-size: 12px; padding: 1px 8px; border-radius: 4px; margin-right: 8px; letter-spacing: .1em; vertical-align: 3px; }
.yorimichi h3 { font-size: 16.5px; color: var(--ink); margin: 18px 0 6px; }
.yorimichi .hj-pair > div, .yorimichi .hj-chart { background: #fff; }
.yori-note { font-size: 13px; color: var(--muted); }

/* 見え方の設定(文字の大きさ・ふりがな・行の間)。ボタンは templates/hojo_topic.html、切りかえは public/hojo.js */
.hj-ui { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; }
.hj-ui .g { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.hj-ui .g > span { font-weight: 700; margin-right: 4px; }
.hj-ui button { font: inherit; min-height: 44px; padding: 4px 12px; border: 2px solid var(--green); background: #fff; color: var(--green); border-radius: 8px; cursor: pointer; }
.hj-ui button[aria-pressed="true"] { background: var(--green); color: #fff; }
html[data-fs="l"] .hj { zoom: 1.2; }
html[data-fs="xl"] .hj { zoom: 1.45; }
.hj ruby rt { font-size: .55em; color: var(--muted); }
html:not([data-ruby="off"]) .hj-body, html:not([data-ruby="off"]) .hj > section { line-height: 2.05; }
html[data-lh="w"] .hj-body, html[data-lh="w"] .hj > section { line-height: 2.3; }
html[data-ruby="off"] .hj rt, html[data-ruby="off"] .hj rp { display: none; }
/* 「新しい漢字だけ」: ページの学年(data-grade)より前の学年で習う漢字のふりがなを隠す。rg7 は小学校で習わない漢字 */
html[data-ruby=new] .hj[data-grade="2"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="2"] ruby.rg1 rp { display: none; }
html[data-ruby=new] .hj[data-grade="3"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="3"] ruby.rg1 rp,html[data-ruby=new] .hj[data-grade="3"] ruby.rg2 rt,html[data-ruby=new] .hj[data-grade="3"] ruby.rg2 rp { display: none; }
html[data-ruby=new] .hj[data-grade="4"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="4"] ruby.rg1 rp,html[data-ruby=new] .hj[data-grade="4"] ruby.rg2 rt,html[data-ruby=new] .hj[data-grade="4"] ruby.rg2 rp,html[data-ruby=new] .hj[data-grade="4"] ruby.rg3 rt,html[data-ruby=new] .hj[data-grade="4"] ruby.rg3 rp { display: none; }
html[data-ruby=new] .hj[data-grade="5"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="5"] ruby.rg1 rp,html[data-ruby=new] .hj[data-grade="5"] ruby.rg2 rt,html[data-ruby=new] .hj[data-grade="5"] ruby.rg2 rp,html[data-ruby=new] .hj[data-grade="5"] ruby.rg3 rt,html[data-ruby=new] .hj[data-grade="5"] ruby.rg3 rp,html[data-ruby=new] .hj[data-grade="5"] ruby.rg4 rt,html[data-ruby=new] .hj[data-grade="5"] ruby.rg4 rp { display: none; }
html[data-ruby=new] .hj[data-grade="6"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="6"] ruby.rg1 rp,html[data-ruby=new] .hj[data-grade="6"] ruby.rg2 rt,html[data-ruby=new] .hj[data-grade="6"] ruby.rg2 rp,html[data-ruby=new] .hj[data-grade="6"] ruby.rg3 rt,html[data-ruby=new] .hj[data-grade="6"] ruby.rg3 rp,html[data-ruby=new] .hj[data-grade="6"] ruby.rg4 rt,html[data-ruby=new] .hj[data-grade="6"] ruby.rg4 rp,html[data-ruby=new] .hj[data-grade="6"] ruby.rg5 rt,html[data-ruby=new] .hj[data-grade="6"] ruby.rg5 rp { display: none; }
html[data-ruby=new] .hj[data-grade="7"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="7"] ruby.rg1 rp,html[data-ruby=new] .hj[data-grade="7"] ruby.rg2 rt,html[data-ruby=new] .hj[data-grade="7"] ruby.rg2 rp,html[data-ruby=new] .hj[data-grade="7"] ruby.rg3 rt,html[data-ruby=new] .hj[data-grade="7"] ruby.rg3 rp,html[data-ruby=new] .hj[data-grade="7"] ruby.rg4 rt,html[data-ruby=new] .hj[data-grade="7"] ruby.rg4 rp,html[data-ruby=new] .hj[data-grade="7"] ruby.rg5 rt,html[data-ruby=new] .hj[data-grade="7"] ruby.rg5 rp,html[data-ruby=new] .hj[data-grade="7"] ruby.rg6 rt,html[data-ruby=new] .hj[data-grade="7"] ruby.rg6 rp { display: none; }
html[data-ruby=new] .hj[data-grade="8"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="8"] ruby.rg1 rp,html[data-ruby=new] .hj[data-grade="8"] ruby.rg2 rt,html[data-ruby=new] .hj[data-grade="8"] ruby.rg2 rp,html[data-ruby=new] .hj[data-grade="8"] ruby.rg3 rt,html[data-ruby=new] .hj[data-grade="8"] ruby.rg3 rp,html[data-ruby=new] .hj[data-grade="8"] ruby.rg4 rt,html[data-ruby=new] .hj[data-grade="8"] ruby.rg4 rp,html[data-ruby=new] .hj[data-grade="8"] ruby.rg5 rt,html[data-ruby=new] .hj[data-grade="8"] ruby.rg5 rp,html[data-ruby=new] .hj[data-grade="8"] ruby.rg6 rt,html[data-ruby=new] .hj[data-grade="8"] ruby.rg6 rp,html[data-ruby=new] .hj[data-grade="8"] ruby.rg7 rt,html[data-ruby=new] .hj[data-grade="8"] ruby.rg7 rp { display: none; }
html[data-ruby=new] .hj[data-grade="9"] ruby.rg1 rt,html[data-ruby=new] .hj[data-grade="9"] ruby.rg1 rp,html[data-ruby=new] .hj[data-grade="9"] ruby.rg2 rt,html[data-ruby=new] .hj[data-grade="9"] ruby.rg2 rp,html[data-ruby=new] .hj[data-grade="9"] ruby.rg3 rt,html[data-ruby=new] .hj[data-grade="9"] ruby.rg3 rp,html[data-ruby=new] .hj[data-grade="9"] ruby.rg4 rt,html[data-ruby=new] .hj[data-grade="9"] ruby.rg4 rp,html[data-ruby=new] .hj[data-grade="9"] ruby.rg5 rt,html[data-ruby=new] .hj[data-grade="9"] ruby.rg5 rp,html[data-ruby=new] .hj[data-grade="9"] ruby.rg6 rt,html[data-ruby=new] .hj[data-grade="9"] ruby.rg6 rp,html[data-ruby=new] .hj[data-grade="9"] ruby.rg7 rt,html[data-ruby=new] .hj[data-grade="9"] ruby.rg7 rp { display: none; }
/* 動く図(<div class="hj-cube">)。JS が動かないときは、段階の説明の一覧だけが見える */
.hj-cube { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 14px 0 18px; background: #fff; }
.hj-cube > .t { font-weight: 700; color: var(--green); margin: 0 0 8px; }
.hj-cube > ol { margin: 0; padding-left: 1.4em; }
.hj-cube.on > ol { display: none; }
.hj-cube-stage { position: relative; background: var(--band); border-radius: 8px; }
.hj-cube-stage svg { display: block; width: 100%; height: auto; max-height: 340px; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.hj-cube-stage svg .lb { font-weight: 700; fill: var(--green); paint-order: stroke; stroke: #fff; }
.hj-cube-hint { position: absolute; right: 8px; top: 6px; font-size: 12px; color: var(--muted); }
.hj-cube-cap { min-height: 3.4em; margin-top: 10px; padding: 8px 12px; border-left: 4px solid var(--green); background: var(--band); border-radius: 0 6px 6px 0; }
.hj-cube-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.hj-cube-bar button { font: inherit; font-size: 15px; min-height: 44px; padding: 4px 14px; border: 2px solid var(--green); background: #fff; color: var(--green); border-radius: 8px; cursor: pointer; }
.hj-cube-bar button:disabled { opacity: .35; cursor: default; }
.hj-cube-bar .n { min-width: 4em; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
@media print { .hj-cube-bar, .hj-cube-hint { display: none; } }
/* 「黒板に映す」へのボタン(templates/hojo_topic.html) */
.hj-board-link { margin: 10px 0 0; }
.hj-board-link a { display: inline-block; font-weight: 700; color: #fff; background: var(--green); border-radius: 8px; padding: 8px 16px; text-decoration: none; }
.hj-board-link a::before { content: "▶ "; }
/* 目次の単元の折りたたみ(hojo_index.html・hojo_hub.html) */
.hj-unit { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: #fff; }
.hj-unit > summary { cursor: pointer; font-weight: 700; font-size: 17px; color: var(--green); padding: 12px 16px; list-style: none; display: flex; align-items: center; gap: 10px; }
.hj-unit > summary::-webkit-details-marker { display: none; }
.hj-unit > summary::before { content: "▶"; font-size: 12px; transition: transform .15s; }
.hj-unit[open] > summary::before { transform: rotate(90deg); }
.hj-unit > summary .n { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--muted); }
.hj-unit > :not(summary) { margin-left: 16px; margin-right: 16px; }
.hj-unit[open] { padding-bottom: 8px; }
.hj-board-link a + a { margin-left: 8px; }
.hj-board-link a.pr { background: var(--cta); }
.hj-board-link a.pr::before { content: ""; }
/* 家系図(本文に SVG で書く。class="hj-kakei") */
.hj-kakei { margin: 12px 0 16px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; break-inside: avoid; }
.hj-kakei svg { display: block; width: 100%; height: auto; font-family: var(--body); }

/* ---- 読みやすさの試作(style: v2、2026-10-22)----
   文化審議会「公用文作成の考え方」(一文50〜60字を目安)と、文部科学省「拡大教科書の標準的な規格」
   (ルビは本文の半分以上・字間を詰めない・長いルビでも漢字の字間を広げすぎない・ルビがあるときは行間を広く)に合わせる */
.hj-v2 { font-size: 18px; color: #2b3330; }
.hj-v2 .hj-body p, .hj-v2 > section p { margin: 0 0 26px; }
html:not([data-ruby="off"]) .hj-v2 .hj-body, html:not([data-ruby="off"]) .hj-v2 > section { line-height: 2.15; }
.hj-v2 .hj-body section { margin-top: 56px; }
.hj-v2 h2 { font-size: 24px; }
.hj-v2 .hj-body h3 { font-size: 19.5px; color: var(--green); margin: 34px 0 12px; padding-left: 12px; border-left: 5px solid var(--green); line-height: 1.6; }
.hj-v2 rt { font-size: .52em; }
/* 長いふりがなで漢字の字間が広がらないよう、ふりがなを左右にはみ出させる */
.hj-v2 rt { margin-inline: -1em; }
.hj-v2 .hj-why, .hj-v2 .hj-tatoe { margin: 8px 0 28px; }
.hj-v2 ul.hj-list, .hj-v2 ol.hj-list { margin: 0 0 26px; padding-left: 1.4em; }
.hj-v2 .hj-list li { margin: 0 0 6px; }

/* 節の終わりの「ここがポイント」 */
.hj-point { border: 2px solid var(--green); border-radius: 10px; padding: 10px 16px; margin: 4px 0 8px; background: #fff; }
.hj-point::before { content: "ここがポイント"; display: block; font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--green); margin-bottom: 2px; }

/* 本文中の「もっとくわしく」への案内 */
.hj-more { margin: 0 0 26px; }
.hj-more a { display: inline-block; border: 1.5px dashed var(--green); border-radius: 8px; padding: 6px 14px; text-decoration: none; color: var(--green); font-weight: 700; font-size: .92em; }
.hj-more a::before { content: "🔗 もっとくわしく:"; font-weight: 400; margin-right: 4px; }

/* 教科書の範囲をこえる内容の札(もっとくわしくのページ・中学ではここが など) */
.hj-ext { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: #fff; background: #8a4b9c; border-radius: 4px; padding: 1px 8px; margin-right: 8px; vertical-align: 2px; }
.hj-ext-note { border: 2px solid #8a4b9c; border-radius: 10px; padding: 10px 14px; margin: 14px 0 0; font-size: 15px; line-height: 1.8; }
section.hj-hatten { border: 2px solid #8a4b9c; border-radius: 12px; padding: 4px 18px 6px; }
section.hj-hatten > h2::before { content: "教科書の範囲をこえる内容"; display: block; width: fit-content; font-size: 12px; letter-spacing: .06em; color: #fff; background: #8a4b9c; border-radius: 4px; padding: 1px 8px; margin: 10px 0 6px; }

/* もっとくわしくのページの一覧 */
.hj-subs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hj-subs a { display: block; border: 2px solid #8a4b9c; border-radius: 10px; padding: 10px 14px; text-decoration: none; color: var(--ink); }
.hj-subs a b { color: #6d3a7c; }
.hj-subs a span { display: block; font-size: 14px; color: var(--muted); }
.hj-subs-mini { list-style: none; margin: 4px 0 4px 6px; padding: 0 0 0 12px; border-left: 3px solid #8a4b9c; font-size: 14.5px; }
.hj-subs-mini .h { font-size: 12px; font-weight: 700; color: #6d3a7c; }
.hj-flow .hj-subs-mini li { padding: 2px 0 2px 4px; }
.hj-flow .hj-subs-mini li::before { display: none; }
.hj ul.hj-list { list-style: disc; } .hj ol.hj-list { list-style: decimal; }

/* 学習指導要領での位置づけ(「教科書では」の欄の中。本文より一段小さく、色も控えめに) */
.hj-cos { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--line, #d8e0dc); font-size: 14px; color: var(--muted); line-height: 1.7; }
.hj-cos p { margin: 4px 0; }
.hj-cos .h { font-weight: 700; margin-bottom: 2px; }
.hj-cos .code { font-size: 12px; white-space: nowrap; }
