/* "How it works" dialog (how-it-works.js) and the shared dialog shell used by the patient view. */
.hiw { width: min(780px, calc(100% - 24px)); max-height: 90dvh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 20px 60px #0004; color: var(--ink); overflow: hidden; }
.hiw[open] { display: flex; flex-direction: column; }
.hiw::backdrop { background: #141821a6; backdrop-filter: blur(2px); }
.hiw-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.hiw-head h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.hiw-x { margin-inline-start: auto; flex: none; width: 40px; height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: 16px; cursor: pointer; }
.hiw-body { overflow-y: auto; padding: 14px 20px 24px; font-size: 15px; line-height: 1.6; }
.hiw-body h3 { font-size: 19px; margin: 26px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); scroll-margin-top: 8px; }
.hiw-body h4 { font-size: 15px; margin: 16px 0 6px; }
.hiw-body p { margin: 0 0 10px; } .hiw-body ul, .hiw-body ol { margin: 0 0 12px; padding-inline-start: 20px; } .hiw-body li { margin-bottom: 4px; }
.hiw-src { font-size: 13px; color: var(--muted); }
.hiw-src .badge { font: 700 10.5px "Plus Jakarta Sans", system-ui, sans-serif; font-style: normal; text-transform: uppercase; background: #f5b400; color: #3d2c00; border-radius: 5px; padding: 1px 6px; margin-inline-end: 4px; }
.hiw-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.hiw-toc button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; min-height: 34px; padding: 0 11px 0 4px; font: 600 12.5px "Plus Jakarta Sans", system-ui, sans-serif; color: var(--ink); cursor: pointer; }
.hiw-toc button b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--indigo-soft); color: var(--indigo); font: 700 11px "JetBrains Mono", ui-monospace, monospace; }
.hiw-toc button:hover { border-color: var(--indigo); }
.hiw-123 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.hiw-123 div { background: var(--indigo-soft); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 14px; line-height: 1.3; }
.hiw-123 b { display: block; font: 800 22px "JetBrains Mono", ui-monospace, monospace; color: var(--indigo); }
.hiw-123 small { display: block; font-weight: 500; color: var(--muted); margin-top: 4px; }
.hiw-note { background: #f6f7fb; border-inline-start: 3px solid var(--indigo); border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.hiw-scroll { overflow-x: auto; margin: 8px 0 14px; }
.hiw-t5 { border-collapse: collapse; width: 100%; font: 600 13px "JetBrains Mono", ui-monospace, monospace; text-align: center; }
.hiw-t5 th, .hiw-t5 td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.hiw-t5 small { display: block; font: 500 10px "Plus Jakarta Sans", system-ui, sans-serif; color: var(--muted); white-space: nowrap; }
.hiw-t5 tbody th { text-align: start; }
.hiw-t5 tbody tr:nth-child(odd) { background: #fafbfd; }
.hiw-t5 tfoot td, .hiw-meta span { font: 700 11px "Plus Jakarta Sans", system-ui, sans-serif; }
.odd { color: #a3161b; } .even { color: #00804a; }
.hiw-sys { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.hiw-sys h4 { margin: 0 0 4px; } .hiw-sys h4 b { color: var(--indigo); font-family: "JetBrains Mono", ui-monospace, monospace; } .hiw-sys h4 span { color: var(--muted); font-weight: 500; }
.hiw-sys p { font-size: 14px; margin-bottom: 6px; }
.hiw-meta { display: flex; flex-wrap: wrap; gap: 6px; } .hiw-meta span { background: #f1f3f7; border-radius: 6px; padding: 2px 8px; }
.hiw-pairs { font: 600 12.5px "JetBrains Mono", ui-monospace, monospace; color: var(--indigo); }
.hiw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-bottom: 10px; }
.hiw-grid > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.hiw-grid ul { margin: 4px 0; } .hiw-grid small { color: var(--muted); }
.hiw-case { border: 1px solid #f5d27a; background: #fffbef; border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; }
.hiw-case p { margin: 6px 0 0; } .hiw-case ul { margin-top: 6px; }
@media (max-width: 560px) {
  .hiw { width: 100%; max-height: 100dvh; height: 100dvh; max-width: 100%; border-radius: 0; }
  .hiw-123 { grid-template-columns: 1fr; }
  .hiw-body { padding: 12px 16px 24px; }
}
/* Teaching figures (study/figures.js): organ clock + six levels. */
.fig { --fs1: #4b5bdc; --fs2: #00804a; --fs3: #a4237a; --fs4: #e5484d; --fs5: #f08a24; margin: 12px auto 18px; max-width: 360px; }
.fig svg { display: block; width: 100%; height: auto; }
.fig text { font-family: "JetBrains Mono", monospace; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.fig .clk, .fig .lvl-ch { cursor: pointer; outline: none; transition: opacity .15s; }
.fig .clk path, .fig .lvl-ch rect { stroke: #fff; stroke-width: 1.5; }
.clk-code { font-size: 15px; font-weight: 800; fill: #fff; paint-order: stroke; stroke: #0005; stroke-width: 2px; }
.clk-hr { font-size: 9.5px; font-weight: 600; fill: #fff; paint-order: stroke; stroke: #0004; stroke-width: 1.5px; }
.clk-hub { fill: #fff; stroke: var(--line); }
.clk-hub-code { font-size: 20px; font-weight: 800; fill: var(--ink); }
.clk-hub-sub { font-size: 10px; font-weight: 600; fill: var(--muted); }
.lvl-cell { stroke: var(--line); } .lvl-yang { fill: #fff8ef; } .lvl-yin { fill: #f2f4fb; }
.lvl-name { font: 700 11px "Plus Jakarta Sans", sans-serif; fill: var(--ink); }
.fig .lvl-code { font-size: 14px; font-weight: 800; fill: #fff; text-anchor: start; paint-order: stroke; stroke: #0005; stroke-width: 2px; }
.lvl-limb { font: 600 10px "Plus Jakarta Sans", sans-serif; fill: #fff; paint-order: stroke; stroke: #0004; stroke-width: 1.5px; }
.fig.has-sel .clk:not(.on, .s1, .s4, .s5, .nb), .fig.has-sel .lvl-ch:not(.on, .s1, .s2, .s3) { opacity: .22; }
.fig .on path, .fig .on rect { stroke: var(--ink); stroke-width: 3.5; }
.fig .s1 path, .fig .s1 rect { stroke: var(--fs1); stroke-width: 3.5; }
.fig .s2 rect { stroke: var(--fs2); stroke-width: 3.5; }
.fig .s3 path, .fig .s3 rect { stroke: var(--fs3); stroke-width: 3.5; stroke-dasharray: 5 3; }
.fig .s4 path { stroke: var(--fs4); stroke-width: 4; }
.fig .s5 path { stroke: var(--fs5); stroke-width: 4; stroke-dasharray: none; }
.fig .clk:focus-visible path, .fig .lvl-ch:focus-visible rect { stroke: var(--indigo); stroke-width: 4; }
.fig-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin: 8px 0 4px !important; font: 600 11.5px "Plus Jakarta Sans", sans-serif; color: var(--muted); }
.sw::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 4px; vertical-align: -1px; border: 2.5px solid currentColor; box-sizing: border-box; }
.sw-on::before { color: var(--ink); } .sw-s1::before { color: #4b5bdc; } .sw-s2::before { color: #00804a; }
.sw-s3::before, .sw-nb::before { color: #a4237a; border-style: dashed; } .sw-s4::before { color: #e5484d; } .sw-s5::before { color: #f08a24; }
.fig-cap { min-height: 2.6em; margin: 0 !important; font: 600 12.5px/1.45 "JetBrains Mono", monospace; color: var(--indigo); text-align: center; overflow-wrap: anywhere; }

.hiw-try { display: inline-flex; align-items: center; margin-top: 6px; min-height: 36px; border: 1px solid var(--indigo); background: #fff; color: var(--indigo); border-radius: 10px; padding: 0 12px; font: 600 13px "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; }
.hiw-try:hover { background: var(--indigo-soft); }
