/* A bounded tree keeps its controls and drawing visible together. */
#whole-tree{margin:24px 0 34px;padding:18px;border:1px solid #d5cdbd;border-radius:18px;background:#f5f2eb;scroll-margin-top:12px}
#whole-tree h2{font-size:clamp(24px,4vw,34px);margin:0 0 8px;overflow-wrap:anywhere}
#whole-tree[hidden],#person-choice[hidden],#tree-extras[hidden],#tree-reel[hidden],#tree-help[hidden],[id^="entry-"][hidden],#family-branch-view[hidden]{display:none!important}
.whole-status{font-weight:600;line-height:1.5;margin:10px 0}
.whole-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:14px 0}
.whole-tools button,.whole-tools input,.whole-tools select{min-height:48px;border:1px solid #89765b;border-radius:8px;background:#fff;padding:10px 12px;color:#30291f;font:inherit;max-width:100%}
.whole-tools button{cursor:pointer;font-weight:700}
.whole-tools button[aria-pressed="true"]{background:#403725;color:#fff}
.whole-tools label{display:flex;gap:8px;align-items:center;flex-wrap:wrap;min-width:0}
.whole-tools input{width:260px}
.whole-selected-person{line-height:1.5;margin:12px 0}
.whole-tree-canvas{min-width:0;scroll-margin-top:12px}
.whole-stage{position:relative;display:grid;grid-template-rows:auto minmax(0,1fr) auto;width:100%;height:min(900px,calc(100svh - 24px));min-height:min(380px,calc(100svh - 24px));overflow:hidden;background:#fcfbf8;border:1px solid #b7aa91;border-radius:12px;isolation:isolate}
.whole-stage:focus-visible{outline:3px solid #815913;outline-offset:3px}
.whole-stage>svg{grid-row:2;display:block;min-height:0;width:100%;height:100%;max-width:none;overflow:hidden;touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.whole-stage>svg:active{cursor:grabbing}
.whole-stage foreignObject{touch-action:none}
.whole-stage.expanded{position:fixed;inset:8px;width:auto;height:auto;min-height:0;z-index:11000;box-shadow:0 0 0 12px #fcfbf8}
body.tree-is-expanded{overflow:hidden}
.whole-zoom-dock{grid-row:1;position:relative;z-index:2;display:grid;gap:6px;padding:8px;border-bottom:1px solid #c8bea9;background:#f5f2eb;touch-action:manipulation}
.whole-zoom-dock .whole-primary-tools{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:0;flex-basis:100%}
.whole-zoom-dock .whole-primary-tools button{font-size:14px;padding:6px}
.whole-zoom-dock .whole-primary-tools{grid-template-columns:repeat(2,minmax(0,1fr))}
.whole-zoom-dock #whole-return{display:block}
.whole-context-tools{display:grid;grid-template-columns:minmax(0,1fr) 105px;gap:8px;width:100%}
.whole-context-tools label{font:600 12px/1.2 system-ui;min-width:0}
.whole-context-tools select{display:block;width:100%;min-width:0;min-height:40px;margin-top:3px;padding:6px;border:1px solid #89765b;border-radius:7px;background:#fff;color:#30291f;font:16px system-ui}
.whole-generation-split{margin:0;font:600 13px/1.3 system-ui;color:#51432e}
.whole-comparison-tools{margin:0;flex-basis:100%;min-width:0}
.whole-comparison-tools a{display:inline-flex;align-items:center;box-sizing:border-box;min-height:44px;max-width:100%;padding:4px 0;color:#51432e;font:600 14px/1.3 system-ui;text-decoration:underline;overflow-wrap:anywhere}
.whole-comparison-tools a:focus-visible{outline:3px solid #815913;outline-offset:2px}
.whole-zoom-dock #whole-connections[aria-pressed="true"],.whole-zoom-dock #whole-return[aria-pressed="true"]{background:#403725;color:#fff}
.whole-zoom-buttons{display:grid;grid-template-columns:48px 54px 48px minmax(0,1fr);gap:6px}
.whole-navigation-buttons{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.whole-zoom-dock button{min-width:0;min-height:48px;padding:7px;border:1px solid #776442;border-radius:7px;background:#fff;color:#30291f;font:700 16px/1.2 system-ui;cursor:pointer;touch-action:manipulation}
.whole-zoom-dock #whole-in,.whole-zoom-dock #whole-out{font-size:27px}
.whole-zoom-dock #whole-readable{background:#fff0bb}
.whole-zoom-dock button:active,.whole-pan-tools button:active{background:#e5dac4}
.whole-zoom-dock button:focus-visible,.whole-pan-tools button:focus-visible{outline:3px solid #815913;outline-offset:1px}
.whole-zoom-dock output{display:flex;align-items:center;justify-content:center;font:700 16px system-ui;color:#30291f;font-variant-numeric:tabular-nums}
.whole-movement-row{grid-row:3;display:flex;align-items:center;gap:8px;padding:6px;border-top:1px solid #c8bea9;background:#f5f2eb;min-width:0;flex-wrap:wrap}
.whole-pan-tools{display:grid;grid-template-columns:repeat(4,minmax(44px,1fr));gap:6px;flex:1;min-width:0;touch-action:manipulation}
.whole-pan-tools button{min-width:44px;min-height:48px;padding:6px;border:1px solid #776442;border-radius:7px;background:#fff;color:#30291f;font:700 17px system-ui;cursor:pointer;touch-action:manipulation}
.whole-map-panel{position:relative;z-index:3;flex:0 0 68px;border:1px solid #b7aa91;border-radius:7px;background:#fff;color:#30291f;padding:4px;min-width:0}
.whole-map-panel>summary{display:flex;align-items:center;justify-content:center;min-height:38px;cursor:pointer;font:700 15px system-ui}
.whole-map-panel>summary::before{content:'▸';margin-right:5px}
.whole-map-panel[open]>summary::before{content:'▾'}
.whole-map-panel svg{position:absolute;right:0;bottom:calc(100% + 10px);display:block;width:min(260px,calc(100vw - 52px));height:110px;max-width:none;border:2px solid #89765b;border-radius:7px;background:#f9f7f2;box-shadow:0 3px 14px #0003;touch-action:none;cursor:crosshair}
.tree-map-group{fill:#f1ede4;stroke:#d3c7b0;stroke-width:1;vector-effect:non-scaling-stroke}
.tree-map-person{fill:#657c8a}.tree-map-selected{fill:#c48710}
.tree-map-viewport{fill:#3180b8;fill-opacity:.18;stroke:#1261a0;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none}
.whole-gesture-help{font-size:15px;line-height:1.5}
.overview-group{fill:#f1ede4;stroke:#d3c7b0;stroke-width:2}
.overview-group-label{font:700 24px Georgia,serif;fill:#51432e}
.overview-edge{fill:none;stroke:#8b7755;stroke-width:2.5;opacity:.65;vector-effect:non-scaling-stroke}
.overview-edge.uncertain,.family-edge.uncertain{stroke-dasharray:8 6}
.overview-edge.spouse{stroke:#ad8253;stroke-width:3}
.overview-edge.muted-edge{opacity:.09}
.family-edge-halo{fill:none;stroke:#fcfbf8;stroke-width:10;vector-effect:non-scaling-stroke;pointer-events:none}
.family-edge{fill:none;stroke:#1261a0;stroke-width:4;vector-effect:non-scaling-stroke;pointer-events:none}
.family-edge.spouse{stroke:#a6580b}
.overview-person{height:100%;box-sizing:border-box;display:flex;flex-direction:column;gap:6px;padding:10px;border:2px solid #b6a789;border-radius:10px;background:#fff;color:#2e2921;overflow:hidden;font:16px system-ui}
.overview-profile{display:flex;flex:1;min-height:0;flex-direction:column;gap:5px;overflow:hidden;color:inherit;text-decoration:none}
.overview-profile small{font:13px/1.3 system-ui;color:#65563e}
.overview-profile strong{font:700 26px/1.18 system-ui;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;flex-shrink:0}
.overview-years{font:14px/1.25 system-ui;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.overview-profile{justify-content:center}
.overview-years,.overview-actions{display:none!important}
.overview-actions{display:flex;gap:6px;flex:0 0 44px;min-height:44px}
.overview-actions a,.overview-actions button{display:flex;align-items:center;justify-content:center;flex:1;min-width:0;min-height:44px;padding:4px;border:1px solid #89765b;border-radius:5px;background:#fff;color:#382b1b;text-decoration:none;text-align:center;font:700 13px/1.2 system-ui;cursor:pointer}
.overview-profile:focus-visible,.overview-actions a:focus-visible,.overview-actions button:focus-visible{outline:3px solid #815913;outline-offset:-3px}
.overview-person:hover{box-shadow:inset 0 0 0 2px #b89047}
.overview-person.tree-blood{background:#eaf4ff;border-color:#1261a0}
.overview-person.tree-spouse{background:#e8ddf5;border-color:#82659e}
.overview-person.tree-blood-married{background:linear-gradient(to right,#eaf4ff 50%,#e8ddf5 50%);border-color:#1261a0}
.overview-person.selected-person{background:#fff0bb;border:4px solid #815913;box-shadow:inset 0 0 0 2px #fff}
.tree-visible-color-key{display:flex;gap:10px 18px;align-items:center;flex-wrap:wrap;padding:12px;margin:12px 0;border:1px solid #b7aa91;border-radius:8px;background:#fff;font:15px/1.4 system-ui;color:#30291f}
.tree-visible-color-key strong{flex-basis:100%}
.tree-visible-color-key span{display:inline-flex;gap:7px;align-items:center}
.tree-visible-color-key i{display:inline-block;flex:0 0 26px;width:26px;height:22px;border:1px solid #89765b;border-radius:4px}
.selected-swatch{background:#fff0bb}.blood-swatch{background:#eaf4ff}.spouse-swatch{background:#e8ddf5}.married-swatch{background:linear-gradient(to right,#eaf4ff 50%,#e8ddf5 50%)}.other-swatch{background:#fff}
.tree-more-options>summary,.whole-relationship-evidence>summary,.whole-accessible-list>summary{display:flex;align-items:center;min-height:48px;margin:14px 0;padding:10px 12px;border:1px solid #b7aa91;border-radius:8px;background:#fff;font-weight:700;cursor:pointer}
.tree-more-options>summary::after,.whole-relationship-evidence>summary::after,.whole-accessible-list>summary::after{content:'＋';margin-left:auto;padding-left:8px}
.tree-more-options[open]>summary::after,.whole-relationship-evidence[open]>summary::after,.whole-accessible-list[open]>summary::after{content:'−'}
.whole-accessible-list ul{columns:3}.whole-accessible-list li{break-inside:avoid;margin-bottom:8px}
.family-branch-select{display:block;width:100%;max-width:540px;min-height:48px;margin-top:8px;padding:10px;font:inherit;border:1px solid #89765b;border-radius:7px;background:#fff;color:#28231b}
.tree-entry-search{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.tree-entry-search .name-combobox,.tree-entry-search>input{flex:1;min-width:min(200px,100%)}
.tree-entry-search input{box-sizing:border-box;width:100%;min-height:48px;padding:10px;font:17px system-ui;border:1px solid #89765b;border-radius:7px}
body.tree-exploring #tree-start{display:none}
[id^="entry-by-"][aria-pressed="true"]{box-shadow:inset 0 0 0 3px #493e29}
.tree-generation-control{display:inline-flex;align-items:center;gap:8px;font:700 16px system-ui}
.whole-tools .tree-generation-control input{width:76px;font-size:18px}
.tree-person-actions{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:12px;margin:12px 0;border:1px solid #b7aa91;border-radius:8px;background:#fff}
.tree-person-actions label{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font:700 17px system-ui}
.tree-person-actions select{max-width:100%;width:300px;min-height:48px;padding:8px;font:17px system-ui;border:1px solid #89765b;border-radius:6px;background:#fff}
.tree-person-actions button{min-height:48px;padding:10px 16px;border:1px solid #776442;border-radius:7px;font:700 17px system-ui;background:#fff3d9;color:#30291f;cursor:pointer}
.tree-switch-dialog{width:min(540px,calc(100% - 24px));max-height:calc(100dvh - 32px);overflow:auto;box-sizing:border-box;border:2px solid #89765b;border-radius:14px;padding:24px;background:#fcfbf8;color:#30291f}
.tree-switch-dialog::backdrop{background:#0008}.tree-switch-dialog h2{margin-top:0}
.tree-switch-dialog label{display:block;margin:16px 0 8px;font:700 18px system-ui}
.tree-switch-dialog input,.tree-switch-dialog select{display:block;box-sizing:border-box;width:100%;min-height:50px;padding:10px;font:17px system-ui;border:1px solid #89765b;border-radius:6px}
.tree-switch-dialog .name-combobox{display:block;width:100%}.tree-switch-dialog .name-suggestions{max-height:200px}
.tree-switch-actions{display:flex;justify-content:flex-end;margin-top:20px}.tree-switch-actions button{min-height:48px;padding:10px 20px;font:700 17px system-ui}.tree-switch-dialog p{line-height:1.5}
.silverstein-lineage .overview-person{padding:7px;gap:3px}.silverstein-lineage .overview-profile strong{font-size:18px}.silverstein-lineage .overview-profile small{display:none}.silverstein-lineage .overview-years{font-size:12px}.silverstein-lineage .overview-actions{flex-basis:36px;min-height:36px}.silverstein-lineage .overview-actions a,.silverstein-lineage .overview-actions button{font-size:11px;min-height:36px}
.family-tree-page .page-tools{position:static;inset:auto;justify-content:center;flex-wrap:wrap;margin:18px auto;max-width:calc(100% - 24px);width:fit-content;box-shadow:none;z-index:auto}
@media(min-width:761px){.whole-zoom-dock{display:flex;justify-content:space-between;flex-wrap:wrap}.whole-zoom-buttons{grid-template-columns:48px 64px 48px 140px}.whole-navigation-buttons{flex:1;max-width:520px;min-width:300px}}
@media(max-width:760px){#whole-tree{padding:10px 0;border:0;background:transparent}#whole-tree h2,.whole-status,.whole-selected-person,.whole-primary-tools{margin-left:0;margin-right:0}.whole-zoom-dock{padding:6px}.whole-zoom-dock button{font-size:14px}.whole-tools{gap:8px}.whole-tools label{width:100%}.whole-tools input,.whole-tools select{width:100%;box-sizing:border-box}.whole-pan-tools button{font-size:0}.whole-pan-tools button::before{content:attr(data-arrow);font:700 24px system-ui}.whole-accessible-list ul{columns:1}}
@media(max-height:500px){.whole-zoom-dock{display:flex;flex-wrap:wrap;gap:4px;padding:4px}.whole-context-tools{flex:1 1 280px;width:auto}.whole-generation-split{flex:1 1 180px}.whole-zoom-dock .whole-primary-tools{flex:1 1 200px}.whole-zoom-buttons{flex:1 1 240px}.whole-navigation-buttons{flex:1 1 260px}.whole-zoom-dock button{min-height:40px}.whole-map-panel svg{height:70px}.whole-movement-row{padding:4px}}
@media(prefers-reduced-motion:reduce){.whole-stage *{scroll-behavior:auto}}

/* Whole-tree overview is a computer control, including before JS loads. */
[data-computer-tree-only][hidden]{display:none!important}
.whole-zoom-dock .whole-primary-tools{grid-template-columns:repeat(3,minmax(0,1fr))}
.phone-family-tree .whole-zoom-dock .whole-primary-tools{grid-template-columns:repeat(2,minmax(0,1fr))}
.phone-family-tree [data-computer-tree-only]{display:none!important}
@media (pointer:coarse) and (max-width:760px),(pointer:coarse) and (max-height:760px){
 [data-computer-tree-only]{display:none!important}
 .whole-zoom-dock .whole-primary-tools{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* A compact reading toolbar leaves room for relatives on small screens. */
.whole-zoom-dock{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;padding:6px}
.whole-context-tools{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:8px}
.whole-context-tools label{font-size:13px}
.whole-generation-split{font:600 14px/1.3 system-ui}
.whole-reading-tools{display:grid;grid-template-columns:124px minmax(0,1fr) minmax(0,1fr);gap:6px}
.whole-zoom-buttons{grid-template-columns:40px minmax(28px,1fr) 40px;gap:4px}
.whole-zoom-dock button{min-height:44px;padding:5px;font:700 14px/1.2 system-ui}
.whole-zoom-dock output{font-size:14px}
.whole-other-tools{display:grid;grid-template-columns:86px minmax(0,1fr) 58px;gap:6px;align-items:center}
.whole-comparison-tools a{display:flex;justify-content:center;min-height:44px;padding:2px;font:700 14px/1.2 system-ui;text-align:center;color:#30291f}
.whole-view-options{position:relative}
.whole-view-options>summary{display:flex;align-items:center;justify-content:center;min-height:44px;padding:5px;border:1px solid #776442;border-radius:7px;background:#fff;font:700 14px system-ui;cursor:pointer}
.whole-view-options>summary::after{content:' ▾'}
.whole-zoom-dock .whole-view-options .whole-primary-tools{position:absolute;right:0;top:calc(100% + 4px);width:min(280px,calc(100vw - 52px));display:grid;grid-template-columns:minmax(0,1fr);padding:8px;border:1px solid #776442;border-radius:8px;background:#fcfbf8;box-shadow:0 3px 12px #0003;z-index:5}
.whole-view-options:not([open])>.whole-primary-tools{display:none!important}
.whole-zoom-dock #whole-readable{background:#fff0bb}
.overview-person{padding:12px;overflow:visible;color:#211b13}
.overview-profile{overflow:visible;justify-content:center;gap:8px}
.overview-profile small{font:700 14px/1.2 system-ui;color:#51432e}
.overview-profile strong{display:block;-webkit-line-clamp:unset;font:700 28px/1.25 system-ui;overflow:visible;overflow-wrap:anywhere;word-break:normal}
.silverstein-lineage .overview-profile strong{font-size:18px;line-height:1.2}
.whole-status{font-size:16px}
@media(min-width:1000px) and (min-height:501px){
 .whole-zoom-dock{grid-template-columns:minmax(280px,1.3fr) minmax(300px,1fr);align-items:center;gap:6px 16px}
 .whole-context-tools{grid-column:1;grid-row:1}.whole-generation-split{grid-column:1;grid-row:2}
 .whole-reading-tools{grid-column:2;grid-row:1}.whole-other-tools{grid-column:2;grid-row:2}
}
/* On a short landscape screen controls sit beside, rather than over, the tree. */
@media(max-height:500px) and (min-width:480px){
 .whole-stage{grid-template-columns:clamp(180px,25vw,216px) minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
 .whole-zoom-dock{grid-column:1;grid-row:1 / 3;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;overflow:auto;border-right:1px solid #c8bea9;border-bottom:0;padding:6px;gap:6px}
 .whole-context-tools{display:grid;flex:none;width:100%;grid-template-columns:minmax(0,1fr)}
 .whole-context-tools label{margin:0}.whole-context-tools select{min-height:40px}
 .whole-generation-split{flex:none}
 .whole-reading-tools{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 .whole-zoom-buttons{grid-column:1 / 3;grid-template-columns:48px minmax(0,1fr) 48px}
 .whole-other-tools{grid-template-columns:minmax(0,1fr) 58px}
 .whole-comparison-tools{grid-column:1 / 3;grid-row:2}
 .whole-view-options .whole-primary-tools{position:static!important;width:100%!important}
 .whole-view-options[open]{grid-column:1 / 3}
 .whole-stage>svg{grid-column:2;grid-row:1}
 .whole-movement-row{grid-column:2;grid-row:2}
 .whole-map-panel svg{height:90px}
}
