/* リスクの考え方。style.css と flow.css の上に重ねる */
.formula { display: flex; align-items: stretch; gap: 10px; margin-bottom: 12px; }
.fx { flex: 1 1 0; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.fx b { display: block; font-size: 16px; }
.fx small { font-size: 12px; color: var(--muted); }
.fx.res { background: #fee2e2; border-color: #fecaca; }
.fx.res b { color: #991b1b; }
.op { align-self: center; font-family: var(--latin); font-size: 22px; font-weight: 700; color: var(--muted); }
.ideas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.idea { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.idea b { display: block; font-size: 14px; margin-bottom: 3px; }
.idea span { font-size: 12.5px; color: var(--ink2); }

/* リスクマップ */
.rmbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rmmode { display: inline-flex; background: var(--line2); border-radius: 999px; padding: 3px; }
.rmmode button { appearance: none; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 700; padding: 6px 16px; border-radius: 999px; cursor: pointer; color: var(--ink2); }
.rmmode button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.rmsum { margin: 0; font-size: 13px; color: var(--ink2); }
.rmsum b { color: #b91c1c; }
.rmlayout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.rmcard { padding: 14px; }
.rmgrid { display: grid; grid-template-columns: 26px repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(96px, auto)) 22px; gap: 4px; }
.rm-yl, .rm-xl { font-size: 12px; font-weight: 700; color: var(--muted); display: grid; place-items: center; }
.rm-cell { border-radius: 8px; padding: 8px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; }
.rm-cell.lv-low { background: #dcfce7; }
.rm-cell.lv-mid { background: #fef3c7; }
.rm-cell.lv-high { background: #fee2e2; }
.rmaxis { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.dot { appearance: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-family: var(--latin); font-weight: 600; font-size: 13px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(15, 23, 42, .25); }
.dot[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 0 0 3px var(--ink); }
.dot:focus-visible, .rmlist button:focus-visible, .rmmode button:focus-visible, .mlist input:focus-visible, .ckreset:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.rmgone { margin-top: 10px; padding: 8px 10px; border: 1px dashed #cbd5e1; border-radius: 8px; font-size: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rmgone[hidden] { display: none; }
.rmgone b { color: #5b21b6; }
.rmgonedots { display: flex; gap: 6px; }
.rmlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rmlist button { appearance: none; width: 100%; font: inherit; color: inherit; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; cursor: pointer; }
.rmlist button:hover { border-color: #94a3b8; }
.rmlist button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.num { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--latin); font-size: 11.5px; font-weight: 600; display: grid; place-items: center; }
.nm { font-size: 13px; }
.rt { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.rt-avoid { background: #ede9fe; color: #5b21b6; }
.rt-reduce { background: #dbeafe; color: #1e40af; }
.rt-transfer { background: #ccfbf1; color: #115e59; }
.rt-accept { background: #e2e8f0; color: #334155; }
.rmdetail { margin-top: 12px; padding: 14px 16px; display: grid; gap: 10px; }
.rdh { display: flex; align-items: center; gap: 10px; }
.rdh h3 { margin: 0; font-size: 16px; flex: 1; }
.rdflow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.rdbox { background: var(--line2); border-radius: 10px; padding: 9px 12px; font-size: 13px; }
.rdbox small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.rdarrow { font-weight: 700; color: var(--muted); }
.lvb { font-style: normal; display: inline-block; margin-top: 4px; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 8px; }
.lvb.lv-high { background: #fee2e2; color: #991b1b; }
.lvb.lv-mid { background: #fef3c7; color: #92400e; }
.lvb.lv-low { background: #dcfce7; color: #166534; }
.lvb.lv-none { background: #ede9fe; color: #5b21b6; }
.rdm b { font-size: 11.5px; color: var(--k-test); }
.rdm ul { margin: 4px 0 0; padding-left: 1.1em; font-size: 13px; color: var(--ink2); }
.rdn { margin: 0; font-size: 12.5px; color: #92400e; background: #fffbeb; border-radius: 8px; padding: 7px 10px; }

/* 4 つの対応 */
.respgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.respcard { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 0 15px 13px; display: flex; flex-direction: column; gap: 7px; overflow: hidden; }
.respcard .rh { margin: 0 -15px; padding: 10px 15px; display: flex; align-items: baseline; gap: 8px; }
.respcard .rh b { font-size: 18px; }
.respcard .rh span { font-size: 12px; font-weight: 700; }
.respcard[data-k="avoid"] .rh { background: #ede9fe; color: #5b21b6; }
.respcard[data-k="reduce"] .rh { background: #dbeafe; color: #1e40af; }
.respcard[data-k="transfer"] .rh { background: #ccfbf1; color: #115e59; }
.respcard[data-k="accept"] .rh { background: #e2e8f0; color: #334155; }
.respcard .an { margin: 0; font-size: 12.5px; color: var(--muted); }
.respcard ul { margin: 0; padding-left: 1.1em; font-size: 12.5px; color: var(--ink2); }
.respcard .nt { margin-top: auto; font-size: 12px; color: var(--ink2); background: var(--line2); border-radius: 8px; padding: 6px 10px; }

/* 元に戻せるか */
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.door { border-radius: 14px; padding: 14px 16px; border: 1px solid; display: flex; flex-direction: column; gap: 6px; }
.door.two { background: #f0fdf4; border-color: #bbf7d0; }
.door.one { background: #fef2f2; border-color: #fecaca; }
.door h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.door h3 small { font-size: 12px; color: var(--muted); font-weight: 700; }
.dic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 16px; color: #fff; flex: none; }
.door.two .dic { background: #16a34a; }
.door.one .dic { background: #dc2626; }
.door .how { margin: 0; font-size: 13px; font-weight: 700; }
.door.two .how { color: #166534; }
.door.one .how { color: #991b1b; }
.door ul { margin: 0; padding-left: 1.1em; font-size: 12.5px; color: var(--ink2); }
#doors .src, #threat .src { margin-top: 10px; }

/* 影響範囲 */
.blgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.blcard { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.blcard b { display: block; font-size: 14px; margin-bottom: 3px; }
.blcard span { font-size: 12.5px; color: var(--ink2); }

/* 事故は重なって起きる */
.lygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ly { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.ly h3 { margin: 0; font-size: 16px; }
.ly p { margin: 0; font-size: 13px; color: var(--ink2); }
.cheese { width: 100%; height: auto; max-height: 230px; }
.cheese .slice { fill: #fde68a; stroke: #d97706; stroke-width: 1.5; }
.cheese .hole { fill: var(--paper); stroke: #d97706; stroke-width: 1; }
.cheese .ray { stroke: #dc2626; stroke-width: 3; fill: none; }
.cheese .rayhead { fill: #dc2626; }
.cheese .clabel { font-size: 15px; font-weight: 700; fill: var(--ink2); text-anchor: middle; }
.cheese .cend { font-size: 14px; font-weight: 700; fill: #dc2626; }
.hpyr { display: grid; gap: 4px; justify-items: center; padding: 6px 0; }
.ht { border-radius: 8px; padding: 8px 10px; text-align: center; font-size: 13px; font-weight: 700; }
.ht b { font-family: var(--latin); font-size: 18px; margin-right: 6px; }
.ht.t1 { width: max(34%, 150px); background: #dc2626; color: #fff; }
.ht.t2 { width: 64%; background: #f59e0b; color: #1f2937; }
.ht.t3 { width: 100%; background: #fde68a; color: #1f2937; }

/* 脅威モデリング */
.qrow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; counter-reset: q; }
.qrow li { counter-increment: q; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 44px; position: relative; }
.qrow li::before { content: counter(q); position: absolute; left: 12px; top: 10px; width: 22px; height: 22px; border-radius: 6px; background: var(--ink); color: #fff; font-family: var(--latin); font-weight: 600; font-size: 12px; display: grid; place-items: center; }
.qrow b { display: block; font-size: 14px; }
.qrow span { font-size: 12px; color: var(--ink2); }
.subh { margin: 20px 0 10px; font-size: 15px; }
.stgrid2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sc { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 3px 12px; align-content: start; }
.sc .L { grid-row: span 4; width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: #fff; font-family: var(--latin); font-size: 22px; font-weight: 600; display: grid; place-items: center; }
.sc h4 { margin: 0; font-size: 14.5px; }
.sc h4 small { font-family: var(--latin); font-weight: 500; font-size: 11px; color: var(--muted); margin-left: 6px; }
.sc p { margin: 0; font-size: 12.5px; color: var(--ink2); }
.sc .g b { color: var(--k-test); font-size: 11.5px; margin-right: 4px; }
.sc a { font-size: 12px; color: #1d4ed8; }
.cvss { padding: 14px 16px; display: grid; gap: 10px; }
.cvss p { margin: 0; font-size: 13px; color: var(--ink2); }
.cvbar { position: relative; display: grid; grid-template-columns: minmax(72px, 4fr) minmax(72px, 3fr) minmax(72px, 2fr) minmax(72px, 1fr); gap: 3px; padding-top: 24px; }
.cvb { border-radius: 6px; padding: 7px 9px; font-size: 13px; font-weight: 700; color: #fff; min-width: 0; }
.cvb small { display: block; font-family: var(--latin); font-weight: 500; font-size: 11px; opacity: .92; }
.cvb.low { background: #16a34a; }
.cvb.mid { background: #d97706; }
.cvb.high { background: #ea580c; }
.cvb.crit { background: #b91c1c; }
.cvmark { position: absolute; right: 0; top: 0; font-size: 12px; font-weight: 700; color: #b91c1c; white-space: nowrap; }

/* 実際の事故 */
.cases { display: grid; gap: 8px; }
.case { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px; display: grid; grid-template-columns: 64px minmax(0, 1.25fr) minmax(0, 1fr); gap: 6px 16px; align-items: start; }
.case .yr { font-family: var(--latin); font-size: 18px; font-weight: 600; grid-row: span 3; }
.case h3 { margin: 0; font-size: 15px; grid-column: 2 / 4; }
.case .wh { margin: 0; font-size: 13px; color: var(--ink2); }
.case .ln { font-size: 12.5px; background: #f0fdf4; color: #14532d; border-radius: 8px; padding: 8px 10px; }
.case .ln b { display: block; font-size: 11px; color: #15803d; margin-bottom: 2px; }
.case .cs { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.case .cs a { color: #1d4ed8; }

/* チェックリスト */
.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mlist label { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.mlist label:hover { background: var(--line2); }
.mlist input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--k-test); flex: none; }
.mlist input:checked + span { color: var(--muted); text-decoration: line-through; }
.ckfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.mcount { font-size: 12.5px; font-weight: 700; color: var(--k-test); }
.ckreset { appearance: none; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink2); cursor: pointer; }
.ckreset:hover { border-color: #94a3b8; }

/* 伝え方 */
.talkcard { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 10px 12px; }
.say { border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.say small { display: block; font-size: 11px; font-weight: 700; margin-bottom: 3px; }
.say.bad { background: #fef2f2; color: #7f1d1d; }
.say.good { background: #f0fdf4; color: #14532d; }
.tp { grid-column: 1 / -1; font-size: 13px; color: var(--ink2); }
.tp b { font-size: 12px; color: var(--ink); }
.tp ol { margin: 4px 0 0; padding-left: 1.3em; }
.habits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.habit { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font-size: 12.5px; color: var(--ink2); }
.habit b { display: block; font-size: 14px; color: var(--ink); margin-bottom: 3px; }
.habit a { color: #1d4ed8; font-size: 12px; }

/* AI 時代のリスク（紫は AI の印） */
.dot.ai, .num.ai { background: #6d28d9; }
.dot.ai[aria-pressed="true"] { background: #fff; color: #6d28d9; box-shadow: 0 0 0 3px #6d28d9; }
.aitag { font-style: normal; font-family: var(--latin); font-size: 10.5px; font-weight: 600; background: #ede9fe; color: #5b21b6; border-radius: 5px; padding: 1px 5px; margin-right: 6px; vertical-align: 1px; }
.aitraits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.aitrait { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.aitrait b { font-size: 14.5px; }
.aitrait p { margin: 0; font-size: 12.5px; color: var(--ink2); }
.aitrait .so { margin-top: auto; font-size: 12.5px; color: #4c1d95; background: #f5f3ff; border-radius: 8px; padding: 6px 10px; }
.aitrait .so a { color: #1d4ed8; }
.ailevels { display: grid; gap: 6px; }
.alv { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.alv .ah { border-radius: 8px; padding: 8px 12px; }
.alv .ah b { display: block; font-size: 14.5px; }
.alv .ah small { font-size: 11.5px; font-weight: 700; }
.alv.low .ah { background: #dcfce7; color: #14532d; }
.alv.mid .ah { background: #fef3c7; color: #78350f; }
.alv.high .ah { background: #fee2e2; color: #7f1d1d; }
.alv ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.alv li { font-size: 12.5px; background: var(--line2); border-radius: 999px; padding: 4px 11px; color: var(--ink2); }
.alvnote { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.agrules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; counter-reset: ag; }
.agrules li { counter-increment: ag; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px 11px 46px; position: relative; }
.agrules li::before { content: counter(ag); position: absolute; left: 14px; top: 11px; width: 22px; height: 22px; border-radius: 6px; background: #6d28d9; color: #fff; font-family: var(--latin); font-weight: 600; font-size: 12px; display: grid; place-items: center; }
.agrules b { display: block; font-size: 14px; }
.agrules span { font-size: 12.5px; color: var(--ink2); }
.fwgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fw { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fw-eu { grid-column: 1 / -1; }
.fw h4 { margin: 0; font-size: 15px; }
.fw p { margin: 0; font-size: 12.5px; color: var(--ink2); }
.fw .fsrc { margin-top: auto; font-size: 12px; color: var(--muted); }
.fw .fsrc a { color: #1d4ed8; }
.eutiers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.eut { border-radius: 10px; padding: 9px 11px; font-size: 12px; }
.eut b { display: block; font-size: 13.5px; }
.eut .rl { display: block; font-weight: 700; font-size: 11.5px; margin: 1px 0 4px; }
.eut.ban { background: #1f2937; color: #fff; }
.eut.high { background: #fee2e2; color: #7f1d1d; }
.eut.mid { background: #fef3c7; color: #78350f; }
.eut.low { background: #dcfce7; color: #14532d; }

@media (max-width: 1100px) {
  .respgrid, .qrow, .stgrid2, .blgrid, .aitraits, .agrules, .eutiers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fwgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .rmlayout, .lygrid, .doors, .ideas, .habits { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .respgrid, .qrow, .stgrid2, .blgrid, .talkcard, .aitraits, .agrules, .fwgrid, .eutiers { grid-template-columns: 1fr; }
  .alv { grid-template-columns: 1fr; }
  .formula { flex-direction: column; gap: 4px; }
  .case { grid-template-columns: 1fr; }
  .case .yr { grid-row: auto; }
  .case h3, .case .cs { grid-column: auto; }
  .rdflow { grid-template-columns: 1fr; }
  .rdarrow { transform: rotate(90deg); justify-self: center; }
}
