/* ngl:start */
/* テーマの .natm-page は overflow-x: hidden で、そのままだと検索欄が画面上部に貼り付かない。 */
.natm-page.ngl-page { overflow: visible; overflow-x: clip; }
.ngl-page [id] { scroll-margin-top: var(--ngl-offset, 120px); }
.ngl-page .ngl-version { display: inline-block; margin: 0 0 6px; padding: 2px 12px; border-radius: 999px; background: #eef4fd; color: var(--natm-primary-dark); font-size: .85em; font-weight: 700; }

/* 検索欄(glossary.js が作る) */
.ngl-tools { position: sticky; top: var(--ngl-top, 0px); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 32px; padding: 12px 14px; background: rgba(255, 255, 255, .97); border: 1px solid var(--natm-border); border-radius: var(--natm-radius); box-shadow: 0 6px 18px rgba(9, 26, 51, .07); }
.ngl-tools .ngl-search { flex: 1 1 260px; margin: 0; }
.ngl-tools .ngl-search input { box-sizing: border-box; width: 100%; margin: 0; padding: 9px 14px; border: 1px solid var(--natm-border); border-radius: 10px; background: #fff; color: var(--natm-text); font: inherit; font-size: 16px; }
.ngl-tools .ngl-search input:focus { outline: 2px solid var(--natm-primary); outline-offset: 1px; border-color: var(--natm-primary); }
.ngl-tools .ngl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ngl-tools .ngl-chips, .ngl-tools .ngl-jump { display: flex; align-items: center; gap: 6px; }
.ngl-tools button, .ngl-tools .ngl-jump a { margin: 0; padding: 5px 13px; border: 1px solid var(--natm-border); border-radius: 999px; background: #fff; color: var(--natm-text); font: inherit; font-size: .88em; font-weight: 700; line-height: 1.5; text-decoration: none; cursor: pointer; }
.ngl-tools button:hover, .ngl-tools .ngl-jump a:hover { border-color: var(--natm-primary); color: var(--natm-primary); }
.ngl-tools button[aria-pressed="true"] { border-color: var(--natm-primary); background: var(--natm-primary); color: #fff; }
.ngl-tools .ngl-status { flex: 1 1 100%; margin: 0; color: var(--natm-text-muted); font-size: .88em; white-space: normal; }
.ngl-tools .ngl-status:empty { display: none; }
.ngl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ngl-hide { display: none !important; }
.ngl-filtering .ngl-toc, .ngl-filtering .ngl-index { display: none; }
.ngl-page mark.ngl-mark { padding: 0 1px; border-radius: 3px; background: #ffe58a; color: inherit; }

/* 目次と索引 */
.ngl-toc > ul { margin: 12px 0 20px; padding-left: 1.2em; columns: 2 300px; column-gap: 36px; }
.ngl-toc li { margin: 2px 0; break-inside: avoid; }
.ngl-toc li ul { margin: 2px 0 8px; padding-left: 1.2em; font-size: .93em; }
.ngl-index .ngl-index-jump { display: flex; flex-wrap: wrap; gap: 6px; white-space: normal; }
.ngl-index .ngl-index-jump a { min-width: 2.2em; padding: 3px 10px; border: 1px solid var(--natm-border); border-radius: 8px; background: #fff; font-weight: 700; text-align: center; text-decoration: none; }
.ngl-index .ngl-index-list { margin: 8px 0 24px; padding: 0; list-style: none; columns: 3 230px; column-gap: 32px; }
.ngl-index .ngl-index-list li { margin: 0; padding: 3px 0; break-inside: avoid; overflow-wrap: anywhere; }
.ngl-index .ngl-ref { margin-left: 4px; color: var(--natm-text-muted); font-size: .8em; }

/* 用語の表 */
.entry-content .ngl-table { width: 100%; margin: 12px 0 22px; border-collapse: collapse; background: var(--natm-surface); font-size: .96em; }
.entry-content .ngl-table th, .entry-content .ngl-table td { padding: 10px 12px; border: 0; border-bottom: 1px solid var(--natm-border); text-align: left; vertical-align: top; }
.entry-content .ngl-table thead th { border-bottom: 2px solid var(--natm-border); background: #eef2fb; color: var(--natm-text); font-size: .9em; white-space: nowrap; }
.entry-content .ngl-table td.ngl-term { width: 26%; min-width: 9em; font-weight: 700; }
.entry-content .ngl-table td.ngl-kind { width: 5.5em; white-space: nowrap; }
.ngl-page tr:target > td { background: #fff7d6; }
.ngl-badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8em; font-weight: 700; line-height: 1.6; }
.ngl-k-nai { background: #e8effd; color: #173c97; }
.ngl-k-natm { background: #e4f5ec; color: #17643a; }
.ngl-k-common { background: #eef0f3; color: #445168; }
.ngl-os { display: inline-block; margin-left: 2px; padding: 0 6px; border: 1px solid #b9c2cf; border-radius: 4px; color: var(--natm-text-muted); font-size: .72em; font-weight: 700; line-height: 1.5; vertical-align: middle; white-space: nowrap; }

@media (max-width: 640px) {
    /* 狭い画面では 1 用語を 1 枚の札にして縦に並べる。 */
    .entry-content .ngl-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .entry-content .ngl-table, .entry-content .ngl-table tbody, .entry-content .ngl-table tr, .entry-content .ngl-table td { display: block; width: auto; }
    .entry-content .ngl-table tr { padding: 10px 0; border-bottom: 1px solid var(--natm-border); }
    .entry-content .ngl-table td, .entry-content .ngl-table td.ngl-term, .entry-content .ngl-table td.ngl-kind { width: auto; min-width: 0; padding: 2px 4px; border: 0; }
    /* 検索欄は貼り付いたままなので、本文を隠しすぎないよう 2 段に収める。 */
    .ngl-tools { gap: 8px; padding: 8px 10px; }
    .ngl-tools .ngl-search { flex-basis: 100%; }
    .ngl-tools .ngl-search input { padding: 7px 12px; }
    .ngl-tools .ngl-row { flex: 1 1 100%; flex-wrap: nowrap; gap: 6px; overflow-x: auto; }
    .ngl-tools button, .ngl-tools .ngl-jump a { flex: none; padding: 3px 11px; white-space: nowrap; }
}
/* ngl:end */
