/* 防災の法と計画の体系図。土台は kihonhou.css（冒頭・目次・スクロールで切り替わる場面・おわり）と、テーマの変数。
   色は「つくる機関」で分ける: 国＝青、都道府県＝緑、市町村＝だいだい、施設・事業者＝紫、住民・地域＝青緑。法律＝藍、発災後＝赤、見直し＝灰。
   色だけに頼らないように、拘束力は、ふちの線（実線・太線・破線・点線）と文字でも区別する。 */
.tk {
  --tk-law: #3d3d8f;      --tk-law-bg: #ececf8;
  --tk-kuni: #1b5cb8;     --tk-kuni-bg: #e8f0fd;
  --tk-ken: #1a7a4a;      --tk-ken-bg: #e4f4ea;
  --tk-shi: #a8480a;      --tk-shi-bg: #fdf0e1;
  --tk-shisetsu: #7a3ea8; --tk-shisetsu-bg: #f1e8f8;
  --tk-jumin: #0f766e;    --tk-jumin-bg: #dff3f1;
  --tk-event: #b3261e;    --tk-event-bg: #fdeceb;
  --tk-cycle: #4b5563;    --tk-cycle-bg: #ececec;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .tk {
    --tk-law: #a9a9f0; --tk-law-bg: #20203f; --tk-kuni: #8ab4ff; --tk-kuni-bg: #16233d; --tk-ken: #7fd89a; --tk-ken-bg: #16301f;
    --tk-shi: #f5b66b; --tk-shi-bg: #3a2810; --tk-shisetsu: #d2a8f0; --tk-shisetsu-bg: #2a1a3a; --tk-jumin: #6fd8cb; --tk-jumin-bg: #12302c;
    --tk-event: #ff9a8f; --tk-event-bg: #3a1c19; --tk-cycle: #b8bcc4; --tk-cycle-bg: #26282c;
  }
}
:root[data-theme="dark"] .tk {
  --tk-law: #a9a9f0; --tk-law-bg: #20203f; --tk-kuni: #8ab4ff; --tk-kuni-bg: #16233d; --tk-ken: #7fd89a; --tk-ken-bg: #16301f;
  --tk-shi: #f5b66b; --tk-shi-bg: #3a2810; --tk-shisetsu: #d2a8f0; --tk-shisetsu-bg: #2a1a3a; --tk-jumin: #6fd8cb; --tk-jumin-bg: #12302c;
  --tk-event: #ff9a8f; --tk-event-bg: #3a1c19; --tk-cycle: #b8bcc4; --tk-cycle-bg: #26282c;
}
/* 段（階層）の色 */
.tk .is-law, .tk .tk-c-law, .tk [data-color="law"] { --kh-accent: var(--tk-law); --kh-tint: var(--tk-law-bg); --c: var(--tk-law); --ct: var(--tk-law-bg); }
.tk .is-kuni, .tk .tk-c-kuni, .tk [data-color="kuni"] { --kh-accent: var(--tk-kuni); --kh-tint: var(--tk-kuni-bg); --c: var(--tk-kuni); --ct: var(--tk-kuni-bg); }
.tk .is-ken, .tk .tk-c-ken, .tk [data-color="ken"] { --kh-accent: var(--tk-ken); --kh-tint: var(--tk-ken-bg); --c: var(--tk-ken); --ct: var(--tk-ken-bg); }
.tk .is-shi, .tk .tk-c-shi, .tk [data-color="shi"] { --kh-accent: var(--tk-shi); --kh-tint: var(--tk-shi-bg); --c: var(--tk-shi); --ct: var(--tk-shi-bg); }
.tk .is-shisetsu, .tk .tk-c-shisetsu, .tk [data-color="shisetsu"] { --kh-accent: var(--tk-shisetsu); --kh-tint: var(--tk-shisetsu-bg); --c: var(--tk-shisetsu); --ct: var(--tk-shisetsu-bg); }
.tk .is-jumin, .tk .tk-c-jumin, .tk [data-color="jumin"] { --kh-accent: var(--tk-jumin); --kh-tint: var(--tk-jumin-bg); --c: var(--tk-jumin); --ct: var(--tk-jumin-bg); }
.tk .is-event, .tk .tk-c-event, .tk [data-color="event"] { --kh-accent: var(--tk-event); --kh-tint: var(--tk-event-bg); --c: var(--tk-event); --ct: var(--tk-event-bg); }
.tk .is-cycle, .tk .tk-c-cycle, .tk [data-color="cycle"] { --kh-accent: var(--tk-cycle); --kh-tint: var(--tk-cycle-bg); --c: var(--tk-cycle); --ct: var(--tk-cycle-bg); }
.tk .is-more { --kh-accent: var(--border-strong); --kh-tint: var(--surface-2); }
/* つくる機関の色 */
.tk .tk-a-kuni { --a: var(--tk-kuni); --abg: var(--tk-kuni-bg); --kh-accent: var(--tk-kuni); }
.tk .tk-a-ken { --a: var(--tk-ken); --abg: var(--tk-ken-bg); --kh-accent: var(--tk-ken); }
.tk .tk-a-shi { --a: var(--tk-shi); --abg: var(--tk-shi-bg); --kh-accent: var(--tk-shi); }
.tk .tk-a-shisetsu { --a: var(--tk-shisetsu); --abg: var(--tk-shisetsu-bg); --kh-accent: var(--tk-shisetsu); }
.tk .tk-a-jumin { --a: var(--tk-jumin); --abg: var(--tk-jumin-bg); --kh-accent: var(--tk-jumin); }
.tk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tk-ac { display: inline-block; padding: 0 .5em; font-size: .75rem; font-weight: 700; line-height: 1.7; color: var(--a); background: var(--abg); border: 1px solid var(--a); white-space: nowrap; }

/* ---- 拘束力のバッジ（色だけに頼らない: 塗り＝義務、太い実線＝努力義務、破線＝できる規定、点線＝法定外） */
.tk-lv { display: inline-block; padding: 0 .6em; font-size: .75rem; font-weight: 700; line-height: 1.7; color: var(--text); background: transparent; border: 1px solid var(--text); white-space: nowrap; }
.tk-lv-must { background: var(--text); color: var(--surface); }
.tk-lv-try { border-width: 3px; padding: 0 .45em; line-height: 1.4; }
.tk-lv-may { border-style: dashed; border-width: 2px; line-height: 1.55; }
.tk-lv-guide { border-style: dotted; border-width: 2px; line-height: 1.55; color: var(--muted); border-color: var(--muted); background: var(--surface-2); }
.tk-lv-none { border-color: transparent; color: var(--muted); padding-inline: 0; }
.tk-how ul { margin: 0; padding-left: 1.3em; display: grid; gap: var(--s2); font-size: .9375rem; line-height: 1.85; }
.tk-how .tk-legend { list-style: none; padding: 0; margin-top: var(--s3); gap: var(--s2); }
.tk-legend li { display: grid; grid-template-columns: 6.2rem 1fr; gap: var(--s3); align-items: start; font-size: .8125rem; line-height: 1.7; color: var(--muted); }
.tk-legend li > .tk-lv { justify-self: start; }
.kh-jump .is-more b { color: inherit; }
.tk .kh-legend span.tk-a-kuni::before, .tk .kh-legend span.tk-a-ken::before, .tk .kh-legend span.tk-a-shi::before, .tk .kh-legend span.tk-a-shisetsu::before, .tk .kh-legend span.tk-a-jumin::before { background: var(--kh-accent); }

/* ---- 左に固定する「階段」 */
.tk-stage .kh-st-year b { font-size: clamp(3.5rem, 6.4vw, 5rem); }
.tk-stage .kh-st-mv b { font-size: clamp(1.75rem, 3.2vw, 2.5rem); }
.tk-stage .kh-st-mv b.is-long { font-size: 1.375rem; }
.tk-cnt { margin: 0; font-size: .875rem; color: var(--muted); }
.tk-cnt b { font-family: var(--font-mono); font-size: 1.375rem; color: var(--kh-accent); margin: 0 .15em; }
.tk-stack { list-style: none; margin: var(--s2) 0; padding: 0; display: grid; gap: 4px; justify-items: center; }
.tk-bar { --w: 100%; width: var(--w); display: flex; align-items: center; gap: var(--s2); padding: 2px var(--s2); min-height: 1.9rem; font-size: .8125rem; line-height: 1.4; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border-strong); border-left: 6px solid var(--c); transition: background-color .35s, color .35s, opacity .35s; opacity: .55; }
.tk-bar[data-i="0"] { --w: 46%; } .tk-bar[data-i="1"] { --w: 54%; } .tk-bar[data-i="2"] { --w: 62%; } .tk-bar[data-i="3"] { --w: 70%; }
.tk-bar[data-i="4"] { --w: 78%; } .tk-bar[data-i="5"] { --w: 88%; } .tk-bar[data-i="6"], .tk-bar[data-i="7"] { --w: 100%; border-style: dashed; border-left-style: solid; }
.tk-bn { font-family: var(--font-mono); font-weight: 700; }
.tk-bl { flex: 1 1 auto; min-width: 0; }
.tk-bc { font-family: var(--font-mono); font-size: .75rem; }
.tk-bar.is-past { background: var(--ct); color: var(--text); opacity: .9; }
.tk-bar.is-on { background: var(--c); color: var(--kh-on); opacity: 1; font-weight: 700; border-color: var(--c); }
.tk-sep { width: 100%; text-align: center; font-size: .75rem; color: var(--muted); letter-spacing: .08em; padding: 1px 0; }
.tk-sep::before, .tk-sep::after { content: "─"; margin-inline: .5em; opacity: .5; }

/* ---- 階段のカード（右） */
.tk-steps { padding: 0; }
.tk-li { margin: 0; padding: 0; min-width: 0; }
.tk-step { position: relative; padding: var(--s5) var(--s5) var(--s4); background: var(--surface); border: 1px solid var(--border-strong); border-left: 8px solid var(--kh-accent);
  box-shadow: var(--bevel-raised); display: grid; gap: var(--s3); scroll-margin-top: calc(var(--head-h, var(--kh-head)) + 16px); }
.tk-step-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s3); }
.tk-no { font-family: var(--font-mono); font-size: 1rem; font-weight: 700; }
.tk-step-title { margin: 0; font-size: clamp(1.25rem, 3vw, 1.625rem); line-height: 1.4; font-weight: 800; text-wrap: balance; }
.tk-step p { margin: 0; line-height: 1.95; }
.tk-step-basis { padding: var(--s2) var(--s4); background: var(--kh-tint); border-left: 4px solid var(--kh-accent); line-height: 1.5 !important; }
.tk-step-basis strong { font-family: var(--font-mono); font-size: 1.25rem; color: var(--kh-accent); }
.tk-ml, .tk-ms { font-size: .8125rem; color: var(--muted); }
.kh-js .tk-step { opacity: .55; transition: opacity .35s ease, box-shadow .35s ease; }
.kh-js .tk-step.is-active { opacity: 1; box-shadow: var(--bevel-raised), 0 0 0 2px var(--kh-accent); }
.kh-js .tk-step-basis { display: none; }
.kh-js .tk-li { padding-block: var(--s3); }
.kh-js .kh-steps.tk-steps { gap: var(--s4); }

/* 成果物の行（押すと、くわしく） */
.tk-items { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: var(--s2); }
.tk-item { background: var(--surface); border: 1px solid var(--border-strong); border-left: 4px solid var(--kh-accent); scroll-margin-top: calc(var(--head-h, var(--kh-head)) + 24px); }
.tk-item summary { display: grid; gap: 3px; padding: var(--s2) var(--s6) var(--s2) var(--s3); cursor: pointer; list-style: none; position: relative; min-height: 2.75rem; }
.tk-item summary::-webkit-details-marker { display: none; }
.tk-item summary::after { content: "＋"; position: absolute; right: var(--s3); top: var(--s2); font-family: var(--font-mono); font-weight: 700; color: var(--muted); }
.tk-item details[open] summary::after { content: "－"; }
.tk-item summary:hover, .tk-item details[open] summary { background: var(--kh-tint); }
.tk-i1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s2); }
.tk-iname { font-weight: 800; font-size: 1rem; line-height: 1.5; }
.tk-i2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); font-size: .8125rem; color: var(--muted); line-height: 1.6; }
.tk-ibody { display: grid; gap: var(--s2); padding: 0 var(--s3) var(--s3); border-top: 1px dashed var(--border); padding-top: var(--s2); }
.tk-ibody p { margin: 0; line-height: 1.9; font-size: .9375rem; }
.tk-note { font-size: .875rem !important; color: var(--muted); }
.tk-refs { font-size: .8125rem !important; line-height: 1.8 !important; overflow-wrap: anywhere; }
.tk-refs span { font-weight: 700; color: var(--muted); margin-right: .4em; }
.tk-refs a, .tk-crefs a, .tk-t-ref a { color: var(--link); }

/* ---- 横のリレー・早見表・法の地図 */
.tk-relay, .tk-table-sec, .tk-lawmap { display: grid; gap: var(--s4); max-width: 78rem; margin-inline: auto; width: 100%; }
.tk-relay > h2, .tk-table-sec > h2, .tk-lawmap > h2 { margin: 0; font-size: clamp(1.375rem, 3.6vw, 2rem); line-height: 1.35; font-weight: 800; }
.tk-relay .kh-lead, .tk-table-sec .kh-lead, .tk-lawmap .kh-lead { max-width: 52rem; }
.tk-rtable { width: 100%; border-collapse: separate; border-spacing: 18px 10px; margin: -10px -18px; width: calc(100% + 36px); table-layout: fixed; }
.tk-rwrap { overflow: hidden; padding: 4px; }
.tk-rtable thead th { text-align: left; vertical-align: bottom; font-size: .9375rem; padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--border-strong); border-top: 6px solid var(--rc); box-shadow: var(--bevel-raised); }
.tk-rtable thead th.tk-rc-h { background: none; border: 0; box-shadow: none; width: 6.5rem; }
.tk-rtable thead th small { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.tk-rno { font-family: var(--font-mono); color: var(--rc); font-weight: 800; }
.tk-rc-c1 { --rc: var(--tk-kuni); --rt: var(--tk-kuni-bg); }
.tk-rc-c2 { --rc: var(--tk-shi); --rt: var(--tk-shi-bg); }
.tk-rc-c3 { --rc: var(--tk-shi); --rt: var(--tk-shi-bg); }
.tk-rc-c4 { --rc: var(--tk-shisetsu); --rt: var(--tk-shisetsu-bg); }
.tk-rtable tbody th { width: 6.5rem; text-align: center; vertical-align: middle; font-size: 1rem; font-weight: 800; padding: var(--s2); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); }
.tk-ricon { display: block; width: 2.5rem; height: 2.5rem; margin: 0 auto var(--s1); fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tk-rtable td { position: relative; vertical-align: top; padding: var(--s3); background: var(--surface); border: 1px solid var(--border-strong); border-top: 4px solid var(--rc); font-size: .875rem; line-height: 1.7; }
.tk-rtable td.tk-rc-c3 { background: var(--rt); border-width: 2px; border-top-width: 5px; }
.tk-rtable td:not(:last-child)::after { content: ""; position: absolute; right: -15px; top: 1.1rem; border-style: solid; border-width: 9px 0 9px 11px; border-color: transparent transparent transparent var(--border-strong); }
.tk-rtable tbody tr:hover td, .tk-rtable tbody tr:focus-within td { background: var(--rt); }
.tk-cwho { margin: 0 0 var(--s1); font-size: .8125rem; font-weight: 800; color: var(--rc); }
.tk-cwhat { margin: 0; }
.tk-crefs { margin: var(--s2) 0 0; font-size: .75rem; line-height: 1.7; overflow-wrap: anywhere; }

.tk-filters { display: grid; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--bevel-sunken); }
.tk-fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.tk-fl { font-size: .8125rem; font-weight: 700; color: var(--muted); min-width: 6.2rem; }
.tk-f { min-height: 2.5rem; padding: 0 var(--s3); font: inherit; font-size: .875rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); cursor: pointer; border-radius: 0; }
.tk-f[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: var(--bevel-sunken); font-weight: 700; }
.tk-f[class*="tk-a-"] { border-left: 5px solid var(--a); }
.tk-search { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.tk-search input { flex: 1 1 14rem; min-height: 2.5rem; padding: 0 var(--s3); font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--bevel-sunken); border-radius: 0; }
.tk-count { margin: 0; font-size: .875rem; color: var(--muted); }
.tk-empty { margin: 0; padding: var(--s4); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.tk-twrap { overflow-x: auto; border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); background: var(--surface); }
.tk-tbl { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 52rem; }
.tk-tbl th { position: sticky; top: 0; text-align: left; padding: var(--s2) var(--s3); background: var(--surface-2); border-bottom: 2px solid var(--border-strong); font-size: .8125rem; white-space: nowrap; }
.tk-tbl td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.7; }
.tk-tbl tbody tr:hover td { background: var(--surface-2); }
.tk-tbl tr[hidden] { display: none; }
.tk-t-act { white-space: normal; min-width: 7rem; }
.tk-t-act .tk-ac { margin: 0 4px 4px 0; }
.tk-t-name a { font-weight: 800; color: var(--text); }
.tk-t-sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: .8125rem; color: var(--muted); }
.tk-t-ref { font-size: .8125rem; overflow-wrap: anywhere; min-width: 11rem; }
.tk-t-layer { white-space: nowrap; font-size: .8125rem; }

.tk-lawgroup { display: grid; gap: var(--s3); }
.tk-lawgroup h3 { margin: 0; font-size: 1.125rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s3); }
.tk-lawgroup h3 small { font-size: .8125rem; font-weight: 400; color: var(--muted); }
.tk-lawgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--s3); }
.tk-law { display: grid; align-content: start; gap: var(--s1); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border-strong); border-top: 5px solid var(--tk-law); box-shadow: var(--bevel-raised); min-width: 0; }
.tk-law h4 { margin: 0; font-size: .9375rem; line-height: 1.5; overflow-wrap: anywhere; }
.tk-law-num { margin: 0; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.tk-law-role { margin: 0; font-size: .875rem; line-height: 1.75; }
.tk-law details { margin-top: var(--s1); font-size: .8125rem; }
.tk-law summary { cursor: pointer; color: var(--link); }
.tk-law ul { margin: var(--s1) 0 0; padding-left: 1.2em; display: grid; gap: 2px; line-height: 1.6; }

/* ---- 狭い画面 */
@media (max-width: 59.99rem) {
  .kh-js .tk-stack, .kh-js .tk-stage .kh-st-mv .tk-ms { display: none; }
  .kh-js .tk-cnt { display: none; }
  .kh-js .tk-li { padding-block: var(--s2); }
}
@media (max-width: 55.99rem) {
  .tk-rwrap { overflow: visible; padding: 0; }
  .tk-rtable, .tk-rtable thead, .tk-rtable tbody, .tk-rtable tr, .tk-rtable th, .tk-rtable td { display: block; width: auto; margin: 0; }
  .tk-rtable { border-spacing: 0; table-layout: auto; width: 100%; }
  .tk-rtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tk-rtable tbody tr { margin-bottom: var(--s5); display: grid; gap: 0; border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--bevel-raised); }
  .tk-rtable tbody th { width: auto; display: flex; align-items: center; justify-content: flex-start; gap: var(--s3); text-align: left; border: 0; border-bottom: 1px solid var(--border-strong); box-shadow: none; }
  .tk-ricon { margin: 0; width: 2rem; height: 2rem; }
  .tk-rtable td { border: 0; border-left: 6px solid var(--rc); border-top: 0; padding: var(--s2) var(--s3) var(--s3); }
  .tk-rtable td::before { content: attr(data-col); display: block; font-size: .75rem; font-weight: 800; color: var(--rc); margin-bottom: 2px; }
  .tk-rtable td.tk-rc-c3 { border-width: 0 0 0 6px; }
  .tk-rtable td:not(:last-child)::after { content: "▼"; position: static; display: block; border: 0; text-align: center; color: var(--muted); font-size: .75rem; margin-top: var(--s2); }
  .tk-fl { min-width: 0; width: 100%; }
  .tk-tbl { min-width: 0; }
  .tk-twrap { overflow: visible; border: 0; box-shadow: none; background: none; }
  .tk-tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tk-tbl, .tk-tbl tbody, .tk-tbl tr, .tk-tbl td { display: block; }
  .tk-tbl tbody tr { margin-bottom: var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--bevel-raised); }
  .tk-tbl tr[hidden] { display: none; }
  .tk-tbl td { border: 0; padding: 2px 0; }
  .tk-t-act, .tk-t-ref { min-width: 0; }
  .tk-t-layer { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .tk-bar, .kh-js .tk-step { transition: none !important; }
}
