/* =====================================================================
   Pedigree workbench – the Risk tab (assets/js/risk-tab.js). Its cards
   are the Tools tab's forms (pedwb.css: .tl-form, .tl-field …), on the
   tokens of app.css (--ink, --line, --accent …).
   ===================================================================== */
.rk-wrap { container-type: inline-size; container-name: risk; }
.rk-main { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px 80px; }
.rk-lead { max-width: 920px; }
.rk-grid { display: grid; grid-template-columns: minmax(300px, 410px) minmax(0, 1fr); gap: 14px; align-items: start; max-width: 1280px; }
.rk-col { display: grid; gap: 12px; align-content: start; min-width: 0; }
.rk-col > .tl-form + .tl-form { margin-top: 0; }
.rk-card { gap: 10px; min-width: 0; }
.rk-h { margin: 0; font-size: 15px; color: var(--ink); }
.rk-hrow { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; }

/* the buttons of a choice of one: the modes of inheritance */
.rk-seg { display: flex; flex-wrap: wrap; gap: 5px; }
.rk-seg button { padding: 4px 11px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font: 13px var(--font); color: var(--ink-2); cursor: pointer; }
.rk-seg button:hover { border-color: var(--accent); color: var(--ink); }
.rk-seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.rk-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.rk-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.rk-inline[hidden] { display: none; }
.tl-input.small.rk-num { width: 6.5em; }
.rk-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-2); }
.rk-more[open] > summary { margin-bottom: 8px; }
.rk-more > .tl-field + .tl-field { margin-top: 10px; }
.rk-facts { font-size: 13.5px; color: var(--ink-2); }
.rk-notes:empty, .rk-summary:empty { display: none; }
.rk-notebox > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.rk-notebox .tl-help { margin-top: 4px; }
.rk-notes .rk-xnote { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--warn); border-radius: var(--radius-s); background: var(--warn-soft); color: var(--ink-2); }

/* the answers */
.rk-answers { display: grid; gap: 12px; align-content: start; min-width: 0; }
.rk-answers.rk-none > :not(.rk-problem) { display: none; }
.rk-problem:empty { display: none; }
.rk-out { display: grid; gap: 8px; min-width: 0; }
.rk-out:empty { display: none; }
.rk-big { display: grid; padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--panel-2); }
.rk-line { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 14px; padding: 5px 0; font-size: 13.5px; }
.rk-line + .rk-line { border-top: 1px solid var(--line); }
.rk-what { color: var(--ink-2); }
.rk-val { font-variant-numeric: tabular-nums; color: var(--ink); }
.rk-line.main .rk-what { color: var(--ink); font-weight: 600; }
.rk-line.main .rk-val { font-size: 17px; font-weight: 700; }
.rk-h4 { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rk-tablewrap { overflow-x: auto; min-width: 0; }
.rk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rk-table th, .rk-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.rk-table thead th { font-size: 12px; font-weight: 600; color: var(--muted); }
.rk-table td { font-variant-numeric: tabular-nums; }
.rk-table tbody th { font-weight: 500; }
.rk-bayes td.rk-post { font-weight: 700; }
.rk-allcard { margin-top: 14px; max-width: 1280px; }
.rk-allcard[hidden] { display: none; }
.rk-all tbody tr.on > * { background: var(--accent-soft); }
.rk-all tbody th .linkbtn { display: inline-flex; flex-direction: column; align-items: flex-start; text-align: left; }
.rk-all tbody th .linkbtn small { font-size: 12px; font-weight: 400; color: var(--muted); }
.rk-all select { max-width: 13em; }
.rk-saved { font-size: 12.5px; color: var(--muted); }
.rk-saved:empty { display: none; }
.rk-saved code { font-size: 12px; }

/* by hand: the Inheritance tab of the pedigree practical */
.rk-handbox { margin-top: 16px; max-width: 1280px; }
.rk-hand { padding: 12px 14px 18px; }
.rk-hand .inh { max-width: 640px; margin: 0 auto 18px; }
.rk-hand .inh h4 { margin: 4px 0 8px; font-size: 15px; }
.rk-hand .inh-desc { font-size: 13.5px; color: var(--ink-2); margin: 8px 0 12px; line-height: 1.45; }
.rk-hand .inh-parents { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.rk-hand .inh-parent { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #eaf2fb; border-radius: 14px; padding: 8px 12px; min-width: 170px; }
.rk-hand .inh-ptitle { font-weight: 700; font-size: 13px; }
.rk-hand .inh-parent select, .rk-hand .calc-row select { border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 3px 6px; font: 13px var(--font); background: #fff; color: var(--ink); }
.rk-hand .inh-x { font-size: 22px; color: var(--muted); }
.rk-hand .inh-gametes { display: flex; justify-content: center; gap: 40px; margin: 12px 0 4px; flex-wrap: wrap; }
.rk-hand .inh-gt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); text-align: center; margin-bottom: 4px; }
.rk-hand .inh-gl { display: flex; gap: 12px; justify-content: center; }
.rk-hand .inh-gam { display: flex; flex-direction: column; align-items: center; font-size: 11.5px; color: var(--muted); }
.rk-hand .inh-gridwrap { margin-top: 10px; overflow-x: auto; }
.rk-hand .inh-grid { border-collapse: separate; border-spacing: 6px; margin: 0 auto; }
.rk-hand .inh-grid th { padding: 0; }
.rk-hand .inh-kid { width: 120px; height: 104px; border-radius: 12px; text-align: center; vertical-align: middle; background: #eaf2fb; border: 2px solid transparent; position: relative; }
.rk-hand .inh-kid.affected { background: #fde7e5; border-color: #f2b8b2; }
.rk-hand .inh-kid.carrier { background: #fff4dc; border-color: #f0dca3; }
.rk-hand .inh-kid.unaffected { background: #e7f5ec; border-color: #c3e4d0; }
.rk-hand .inh-kid.out { opacity: 0.35; }
.rk-hand .inh-kid.out::after { content: ''; position: absolute; inset: 14px; background: linear-gradient(45deg, transparent 47%, #b3261e 47%, #b3261e 53%, transparent 53%), linear-gradient(-45deg, transparent 47%, #b3261e 47%, #b3261e 53%, transparent 53%); }
.rk-hand .inh-lab { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.rk-hand .inh-cond { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 8px 0 0; font-size: 14px; cursor: pointer; }
.rk-hand .inh-cond input { accent-color: var(--accent); width: 16px; height: 16px; }
.rk-hand .inh-sum { margin: 10px auto 0; max-width: 520px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.rk-hand .inh-sum p { margin: 3px 0; }
.rk-hand .inh-key { font-size: 12.5px; color: var(--muted); text-align: center; margin: 8px 0 0; }
.rk-hand .inh-key .sw { display: inline-block; width: 10px; height: 10px; border: 1px solid #8a99ad; margin: 0 4px -1px 10px; }
.rk-hand .inh-key .sw.red { background: #d62828; border-color: #d62828; }
.rk-hand .inh-key .sw.white { background: #fff; }
.rk-hand .inh-calc { border-top: 1px solid var(--line); padding-top: 14px; }
.rk-hand .calc-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; font-size: 14px; }
.rk-hand .calc-row > span { flex: 0 0 220px; color: var(--ink-2); }
.rk-hand .calc-row select { flex: 1; min-width: 200px; }
.rk-hand .calc-row input { width: 80px; border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 4px 6px; font: 13px var(--font); }
.rk-hand .calc-row input.bad { border-color: var(--bad); }
.rk-hand .calc-res { margin-top: 8px; font-size: 15px; background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; }

/* a narrow workbench: one column; a phone: closer to the edges, and the children's squares smaller */
@container risk (min-width: 601px) {
  .rk-all thead th, .rk-all td.rk-n { white-space: nowrap; }
}
@container risk (max-width: 820px) {
  .rk-grid { grid-template-columns: minmax(0, 1fr); }
}
@container risk (max-width: 600px) {
  .rk-main { padding: 12px 12px 80px; }
  .rk-hand { padding: 10px 8px 16px; }
  .rk-hand .calc-row > span { flex-basis: 100%; }
  .rk-hand .calc-row select { min-width: 0; max-width: 100%; }
  .rk-hand .inh-kid { width: 96px; height: 96px; }
  .rk-hand .inh-parents { flex-wrap: nowrap; gap: 6px; }
  .rk-hand .inh-parent { min-width: 0; flex: 1 1 0; max-width: 200px; padding: 8px 6px; }
  .rk-hand .inh-parent select { max-width: 100%; }
  .rk-hand .inh-gametes { gap: 24px; }
}
