:root{--ink:#183e34;--muted:#738077;--paper:#f6f4ec;--line:#e8e9df;--green:#194d3d;--gold:#b28b48;--shadow:0 12px 40px #233d2b06;font-family:'Tajawal',Tahoma,Arial,sans-serif;color:var(--ink);background:var(--paper)}
*{box-sizing:border-box}body{margin:0}button,input,a{font:inherit}button,a,input{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button:disabled{cursor:default;opacity:.35}button{min-height:44px}a{color:inherit}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #c0984b;outline-offset:3px}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.site-header{padding:18px max(24px,calc((100vw - 1440px)/2));background:#fffef9;border-bottom:1px solid var(--line);display:flex;gap:30px;align-items:center}.brand{text-decoration:none;display:flex;align-items:center;gap:12px;min-width:240px}.brand-mark{height:48px;width:48px;display:grid;place-items:center;background:var(--ink);border-radius:15px;color:#e6d5a8;transform:rotate(-3deg)}.brand-mark svg{width:30px;height:30px}.brand strong{display:block;font-size:20px;font-weight:800}.brand small{display:block;font-size:12px;color:var(--muted);margin-top:4px}.site-header nav{display:flex;gap:4px;align-items:center;flex:1;justify-content:center}.site-header nav a{display:flex;align-items:center;gap:8px;min-height:44px;padding:10px 16px;text-decoration:none;border-radius:10px;font-size:14px;font-weight:700;white-space:nowrap}.site-header nav a:hover{background:#f1f2e9}.site-header nav .nav-active{color:var(--green);background:#eaf0e5}.nav-active span{font-size:10px;font-weight:800;background:#fffaf0;border:1px solid #e3d3a4;border-radius:5px;padding:2px 5px;color:#8a6b31}.private-label{font-size:12px;color:#728073;display:flex;align-items:center;gap:7px;white-space:nowrap}.private-label i{width:6px;height:6px;border-radius:50%;background:#9baf85}
main{max-width:1440px;margin:auto;padding:38px 28px 0}.intro{display:flex;justify-content:space-between;align-items:center;gap:40px;margin-bottom:30px}.eyebrow{font-size:12px;font-weight:700;color:#938466;letter-spacing:.1px}h1{font-size:clamp(30px,3.3vw,43px);line-height:1.25;font-weight:800;letter-spacing:-.7px;margin:10px 0 10px}.intro p{color:var(--muted);font-size:15px;line-height:1.9;margin:0;max-width:590px}.overview{display:flex;flex-shrink:0;gap:34px;padding-inline-start:30px;border-inline-start:1px solid #dadfd1}.overview div{text-align:center}.overview strong{display:block;font-size:32px;font-weight:800;line-height:1.4}.overview span{display:block;font-size:11.5px;color:var(--muted);margin-top:4px;white-space:nowrap}.overview div:first-child strong{color:#b18b44}
.search-row{display:flex;gap:12px;align-items:center;margin-bottom:20px}.search-box{flex:1;position:relative;max-width:720px}.search-box>svg{width:21px;height:21px;position:absolute;right:17px;top:15px;stroke:#8a998d;stroke-width:1.7;pointer-events:none}.search-box input{width:100%;height:52px;min-width:0;background:#fffefb;border:1px solid #e0e4d8;border-radius:12px;padding:13px 49px 13px 48px;font-size:15px;color:var(--ink);box-shadow:0 3px 8px #183e3402}.search-box input::placeholder{color:#8a968b}.clear-search{position:absolute;left:5px;top:4px;width:44px;height:44px;border:0;background:none;color:#75887a;font-size:24px}.search-results{position:absolute;top:calc(100% + 6px);left:0;right:0;background:#fffefb;border:1px solid #e0e4d8;border-radius:14px;box-shadow:0 16px 40px #1c3b2b20;z-index:20;max-height:340px;overflow:auto;padding:6px}.search-result{display:block;width:100%;border:0;border-radius:9px;text-align:right;background:none;padding:10px 13px;color:var(--ink)}.search-result:hover,.search-result.search-current{background:#eef2e8}.search-result strong{font-size:15px;font-weight:700;display:block}.search-result small{font-size:12px;color:var(--muted);display:block;line-height:1.8;margin-top:3px}.search-empty{padding:18px;font-size:14px;color:var(--muted)}.soft-button,.icon-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid #dce2d3;border-radius:10px;background:#fffdf8;color:#41604b;font-size:13px;font-weight:700;padding:10px 15px}.soft-button svg{width:18px;height:18px;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.soft-button:hover,.icon-button:hover{background:#eaf0e4}.icon-button{width:44px;flex-shrink:0;font-size:23px;padding:0}.app-status{font-size:12px;color:var(--muted);margin-bottom:12px;min-height:18px}.app-error{border:1px solid #ebcfb5;background:#fff8ed;border-radius:14px;padding:25px;margin-bottom:40px}
.workspace{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:22px;align-items:start;direction:ltr}.workspace>*{direction:rtl}.map-panel{min-width:0;background:#fffefb;border:1px solid var(--line);border-radius:20px;padding:23px;box-shadow:var(--shadow)}.map-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.map-heading h2{font-size:24px;line-height:1.4;margin:5px 0 0;font-weight:800}.breadcrumbs{display:flex;gap:4px;align-items:center;margin:14px 0 17px;min-height:37px;flex-wrap:wrap}.breadcrumbs button{font-size:12px;padding:6px 11px;border:0;border-radius:8px;background:#f2f4ed;color:#6e806f;min-height:34px}.breadcrumbs button:last-of-type{color:#284f3b;background:#e6eddc;font-weight:800}.breadcrumbs .crumb-arrow{color:#b6beaf;font-size:14px;padding:0 1px}.map-toolbar{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:14px}.map-toolbar p{font-size:11.5px;display:flex;align-items:center;gap:6px;margin:0;color:#8b9387}.area-symbol{width:12px;height:12px;border:1px solid #aebea2;background:linear-gradient(135deg,#edf2e8 45%,#c3d0b4 45%);border-radius:3px;flex-shrink:0}.depth-switch{display:flex;border:1px solid #e5e8dc;padding:3px;border-radius:9px;background:#f5f6ef}.depth-switch button{min-height:32px;border:0;border-radius:6px;background:none;padding:5px 12px;font-size:11.5px;color:#7c8879;white-space:nowrap}.depth-switch button[aria-pressed=true]{background:#fff;color:#36593d;box-shadow:0 2px 6px #233d2b0b;font-weight:800}
.family-map{position:relative;direction:ltr;width:100%;height:clamp(450px,53vh,660px);background:#f1f3e9;border-radius:14px;overflow:hidden;border:1px solid #e8ecdf;isolation:isolate}.branch-frame{position:absolute;border-radius:11px;background:var(--tile-light);border:1px solid var(--tile-border);overflow:hidden;box-shadow:0 1px 1px #304b2020;direction:rtl;color:var(--tile-ink)}.branch-frame.frame-selected{outline:3px solid #bc9147;outline-offset:-3px}.branch-caption{position:absolute;inset:0 0 auto;width:100%;height:53px;min-height:44px;display:flex;align-items:center;gap:8px;border:0;background:var(--tile-head);color:var(--tile-ink);padding:8px 12px;text-align:right}.branch-caption:hover{filter:brightness(.97)}.branch-caption strong{font-weight:800;font-size:18px;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.branch-caption .tile-count{font-size:11px;font-weight:700;background:#ffffff8c;border:1px solid #ffffff8c;padding:4px 7px;border-radius:6px;white-space:nowrap}.branch-caption .tile-arrow{font-size:18px;opacity:.5}.subtile{position:absolute;border-radius:7px;border:1px solid #ffffff99;background:var(--sub-fill);color:var(--tile-ink);padding:8px 10px;display:flex;flex-direction:column;justify-content:space-between;align-items:stretch;text-align:right;direction:rtl;overflow:hidden;min-height:0}.subtile button{min-height:0}.subtile strong{font-size:15px;font-weight:800;display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.subtile small{font-size:10.5px;opacity:.7;display:block;margin-top:4px;white-space:nowrap}.subtile:hover{filter:brightness(.96)}.subtile.is-selected{outline:3px solid #a87927;outline-offset:-3px}.subtile .enter-symbol{align-self:flex-end;font-size:19px;opacity:.5;line-height:1}.map-fragment{position:absolute;background:var(--sub-fill);border:1px solid #ffffff70;border-radius:4px;pointer-events:none}.branch-summary{position:absolute;inset:53px 0 0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--tile-ink);cursor:pointer}.branch-summary strong{font-size:clamp(28px,4vw,48px);font-weight:800;line-height:1.4}.branch-summary span{font-size:12px;opacity:.7}.branch-summary small{font-size:10px;opacity:.55;margin-top:12px}.map-bottom{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:17px;font-size:11px;color:#84917f}.legend{display:flex;flex-wrap:wrap;gap:12px}.legend span{display:flex;align-items:center;gap:5px}.legend i{display:block;width:8px;height:8px;border-radius:2px}.map-tip{color:#90998b;font-size:11px;line-height:1.8;border-top:1px solid #edf0e6;margin:16px 0 0;padding-top:13px}.empty-map{height:100%;display:flex;align-items:center;justify-content:center;text-align:center;flex-direction:column;gap:12px;padding:20px;color:#74876d}.empty-map strong{font-size:27px;color:var(--ink)}.empty-map span{font-size:14px}
.family-sidebar{display:flex;flex-direction:column;gap:16px;min-width:0}.person-card{border:1px solid #d5dfcd;background:linear-gradient(130deg,#eff3e7,#f5f7ee);border-radius:18px;padding:21px}.card-eyebrow{color:#83917b;font-size:11px;font-weight:700;margin-bottom:18px}.person-heading{display:flex;align-items:center;gap:11px}.person-mark{width:47px;height:47px;flex-shrink:0;border:1px solid #a7bc9b;background:#dce7d0;color:#416040;border-radius:13px;display:grid;place-items:center;font-size:24px;font-weight:800}.person-heading h2{font-size:23px;line-height:1.4;margin:0;font-weight:800}.person-number{font-size:10.5px;color:#8b9980}.person-lineage{font-size:12px;color:#7e8e73;line-height:1.9;margin:14px 0 18px;overflow-wrap:anywhere}.person-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;text-align:center;border-top:1px solid #dce4d3;border-bottom:1px solid #dce4d3;padding:13px 0 12px;margin-bottom:18px}.person-stats div+div{border-inline-start:1px solid #dce4d3}.person-stats strong{display:block;font-size:21px;font-weight:800}.person-stats span{display:block;font-size:9.5px;color:#8b987f;margin-top:5px}.primary-button{display:flex;align-items:center;justify-content:center;gap:15px;width:100%;padding:12px 16px;border:1px solid #18412d;background:#234e39;color:#fcfaf1;font-weight:700;font-size:13px;border-radius:10px;min-height:46px}.primary-button:hover{background:#183d2b}.primary-button span{font-size:19px;line-height:1}.children-card{border:1px solid var(--line);background:#fffefb;border-radius:18px;padding:18px}.children-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;border-bottom:1px solid #edf0e6;padding-bottom:13px;margin-bottom:5px}.children-heading h3{font-size:14px;font-weight:800;margin:0}.children-heading>span{font-size:11px;color:#849178;background:#f0f3e9;padding:3px 8px;border-radius:5px}.children-list{max-height:330px;overflow:auto;scrollbar-width:thin}.child-item{border:0;background:none;text-align:right;display:flex;align-items:center;gap:9px;width:100%;padding:10px 3px;border-bottom:1px solid #f0f2ea;min-height:58px;color:var(--ink)}.child-item:last-child{border-bottom:0}.child-item:hover,.child-item.child-selected{background:#f2f5eb}.child-dot{width:9px;height:9px;background:var(--child-color);border-radius:3px;flex-shrink:0}.child-info{flex:1;min-width:0}.child-info strong{display:block;font-size:14px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.child-info small{display:block;font-size:10px;margin-top:4px;color:#9ba58f}.child-arrow{font-size:17px;color:#a2ae98}.no-children{padding:18px 2px;font-size:13px;line-height:1.8;color:#909d84}.guide-note{display:flex;align-items:flex-start;gap:9px;padding:0 9px;color:#a0aa91}.guide-note>span{font-size:28px;line-height:1.1;color:#c5cdb8}.guide-note p{font-size:11px;line-height:1.9;margin:0}footer{display:flex;justify-content:space-between;gap:15px;flex-wrap:wrap;border-top:1px solid #e1e6d8;margin-top:31px;padding:21px 0 25px;font-size:11px;color:#9ca68e}.profile-overlay{position:fixed;inset:0;background:#11291fd6;z-index:50;display:flex;align-items:center;justify-content:center;padding:18px}.profile-dialog{width:min(720px,100%);height:90vh;height:90dvh;border-radius:18px;overflow:hidden;display:flex;flex-direction:column;background:#fff}.profile-dialog>header{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:9px 16px;color:#fff;background:#254c38}.profile-dialog>header strong{font-size:15px}.profile-dialog>header button{border:0;border-radius:8px;width:44px;height:44px;font-size:25px;background:#ffffff15;color:#fff}.profile-dialog iframe{width:100%;flex:1;min-height:0;border:0}.loading-map{position:absolute;inset:15px;background:linear-gradient(100deg,#e8eee0,#f3f6ec,#e8eee0);border-radius:10px}
@media(min-width:1600px){.family-map{height:620px}}
@media(max-width:1100px){.site-header{gap:14px;padding:16px 24px}.brand{min-width:215px}.site-header nav a{padding:9px 11px;font-size:13px}.private-label{display:none}.overview{gap:23px;padding-inline-start:20px}.workspace{grid-template-columns:minmax(0,1fr) 280px;gap:16px}.map-panel{padding:18px}.map-toolbar{align-items:flex-start;flex-direction:column;gap:10px}.map-toolbar p{font-size:11px}.intro{gap:25px}.overview strong{font-size:28px}.overview span{font-size:10px}}
@media(max-width:820px){.site-header{flex-wrap:wrap;padding:15px 18px 11px;gap:15px}.brand{flex:1;min-width:0;order:0}.brand strong{font-size:19px}.brand-mark{width:42px;height:42px;border-radius:12px}.site-header nav{order:2;flex:1 1 100%;justify-content:flex-start;overflow-x:auto}.site-header nav a{font-size:12px;padding:8px 13px}.private-label{display:flex;font-size:10px;order:1}.intro{display:block;margin-bottom:23px}.intro p{font-size:13px;line-height:1.9}.overview{margin-top:23px;border-inline-start:0;border-top:1px solid #e1e6d8;padding:19px 0 0;justify-content:space-around;gap:10px}.overview strong{font-size:28px}.overview span{font-size:10px}.workspace{display:flex;flex-direction:column;gap:18px}.map-panel,.family-sidebar{width:100%}main{padding:27px 15px 0}h1{font-size:32px}.eyebrow{font-size:11px}.search-row{gap:8px}.search-box{min-width:0}.search-box input{font-size:16px;height:50px}.soft-button{font-size:0;width:48px;height:50px;padding:0;flex-shrink:0}.soft-button svg{height:22px;width:22px}.map-panel{padding:16px 12px;border-radius:16px}.map-heading h2{font-size:22px}.map-toolbar{flex-direction:row;align-items:center;gap:8px}.map-toolbar p{font-size:10px;max-width:130px;line-height:1.5}.depth-switch button{min-height:44px;font-size:10px;padding:5px 7px}.breadcrumbs button{min-height:44px;font-size:11px}.breadcrumbs{margin:9px 0 12px}.family-map{height:470px;border-radius:10px}.branch-caption{padding:8px;height:50px;gap:4px}.branch-caption strong{font-size:16px}.branch-caption .tile-count{padding:3px 4px;font-size:10px}.branch-caption .tile-arrow{display:none}.subtile{padding:7px}.subtile strong{font-size:15px}.map-bottom{align-items:flex-start;line-height:1.7}.legend{gap:9px;font-size:10px}.map-tip{font-size:10px}.person-card{padding:21px}.person-heading h2{font-size:23px}.person-lineage{font-size:13px}.person-stats span{font-size:11px}.child-info strong{font-size:15px}.child-info small{font-size:11px}.child-item{min-height:62px}.children-heading h3{font-size:15px}.guide-note{padding:0 12px}.guide-note p{font-size:12px}.guide-note>span{font-size:32px}footer{margin-top:23px;font-size:10px;line-height:1.7}.person-card .primary-button{min-height:48px;font-size:14px}}
@media(prefers-reduced-motion:no-preference){.branch-frame{animation:arrive .22s ease-out}@keyframes arrive{from{opacity:.45}to{opacity:1}}button,a{transition:background .15s,filter .15s}}

/* Every child keeps a named, usable tile, including branches with few descendants. */
.family-map{overflow:auto;scrollbar-width:thin;overscroll-behavior:contain}
.map-canvas,.branch-canvas{position:relative;width:100%;direction:ltr}
.branch-label{flex:1;min-width:0;display:block}
.branch-label strong{display:block}
.branch-label small{display:block;font-size:10.5px;opacity:.75;margin-top:2px}
.branch-children{position:absolute;top:55px;right:6px;bottom:6px;left:6px;overflow:auto;direction:ltr;scrollbar-width:thin;overscroll-behavior:contain;touch-action:pan-x pan-y}
.subtile{min-height:44px}
.subtile strong{font-size:15px}

.family-map{scrollbar-gutter:stable}
.branch-canvas{margin-inline:auto}
.branch-children{overflow-x:hidden;overflow-y:auto}

/* Colors describe a relationship to the selected person, with matching text. */
.relationship-key{margin-top:16px;padding-top:13px;border-top:1px solid #edf0e6}
.relationship-key p{margin:0 0 9px;font-size:12px;font-weight:700;color:#50645a;overflow-wrap:anywhere}
.relationship-key .legend{gap:8px 15px;color:#5d6c65;font-size:11px;line-height:1.8}
.relationship-key .legend i{width:10px;height:10px}
.map-bottom{margin-top:10px}
.relative-item{border:0;background:var(--tile-light);text-align:right;display:flex;align-items:center;gap:9px;width:100%;padding:10px 9px;min-height:58px;color:var(--tile-ink);border-inline-start:3px solid var(--child-color);border-radius:8px;margin:5px 0}
.relative-item:last-child{border-bottom:0}
.relative-item:hover,.relative-item.child-selected{background:var(--tile-head)}
.relative-item .child-info small,.relative-item .child-arrow{color:var(--tile-ink);opacity:.8}
.siblings-card{border-color:#c8d9ed}
.siblings-card .children-heading h3{color:#204f86}
.person-card{border-color:#dfcca4;background:linear-gradient(130deg,#fff4dd,#fffaf0)}
.person-mark{border-color:#c6a157;background:#f4e1b4;color:#775414}
.person-card .card-eyebrow,.person-number,.person-lineage,.person-stats span{color:#766746}
.person-stats{border-color:#e8d9b9}
.person-stats div+div{border-color:#e8d9b9}
.branch-label small{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:820px){.relative-item{min-height:62px}.relationship-key .legend{font-size:11px;gap:8px 12px}}

/* Each father is centered above his sons in a lighter shade of his color. */
.family-map{direction:rtl;touch-action:pan-x pan-y;scrollbar-gutter:auto}
.map-canvas.siblings-row{display:grid;align-items:start;gap:24px;padding:16px;min-width:100%;direction:rtl}
.siblings-row .branch-frame{position:relative;inset:auto;width:auto;height:auto;min-width:0;align-self:start;overflow:visible;background:transparent;border:0;box-shadow:none}
.siblings-row .branch-frame.frame-selected{outline:0}
.siblings-row .branch-frame.frame-selected .branch-caption{outline:3px solid #a77927;outline-offset:-3px}
.siblings-row .branch-caption{position:relative;inset:auto;z-index:2;margin-inline:auto;max-width:100%;height:66px;min-height:66px;border:1px solid var(--tile-border);border-radius:11px;padding:10px 12px;gap:8px;box-shadow:0 3px 8px #25382b0b}
.siblings-row .branch-caption strong{font-size:18px;white-space:nowrap;overflow:visible;text-overflow:clip}
.siblings-row .branch-label small{font-size:11px;margin-top:5px}
.siblings-row .branch-children{position:relative;inset:auto;overflow:visible;padding:28px 8px 8px;direction:rtl;touch-action:auto}
.siblings-row .branch-children::before{content:'';position:absolute;top:0;right:calc(50% - 1px);height:15px;width:2px;background:var(--tile-border);pointer-events:none}
.siblings-row .branch-canvas{display:grid;grid-auto-flow:column;grid-template-rows:80px;gap:12px;margin-inline:auto;direction:rtl}
.siblings-row .branch-canvas::before{content:'';position:absolute;top:-14px;left:calc(var(--son-width)/2);right:calc(var(--son-width)/2);height:2px;background:var(--tile-border);pointer-events:none}
.siblings-row .subtile{position:relative;inset:auto;width:100%;height:auto;min-height:80px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:8px;border:1px solid var(--tile-border);border-radius:9px;background:var(--sub-fill);padding:12px;overflow:visible}
.siblings-row .subtile::before{content:'';position:absolute;top:-15px;right:calc(50% - 1px);height:15px;width:2px;background:var(--tile-border);pointer-events:none}
.siblings-row .subtile>span:first-child{min-width:0;flex:1}
.siblings-row .subtile strong{font-size:16px;white-space:nowrap;overflow:visible;text-overflow:clip}
.siblings-row .subtile small{font-size:11px;opacity:.85;overflow:hidden;text-overflow:ellipsis}
.siblings-row .subtile .enter-symbol{align-self:center;flex-shrink:0;font-size:18px}
.siblings-row .branch-empty{margin:23px 8px 0;padding:17px 8px;min-height:70px;font-size:12px;text-align:center;color:var(--tile-ink);background:var(--tile-light);border:1px dashed var(--tile-border);border-radius:9px}
.area-symbol{background:#dce8d8;border-radius:3px;box-shadow:-4px 0 #e8d4bd,4px 0 #c9dcec;margin-inline:4px}
.relationship-key p{line-height:1.8}
@media(max-width:820px){.siblings-row .branch-caption strong{font-size:17px}.siblings-row .branch-caption .tile-arrow{display:inline}.map-toolbar{flex-wrap:wrap}.map-toolbar p{max-width:none}}

/* Compact, readable cards stay inside the viewport. */
.family-map{height:auto;min-height:260px;overflow-x:hidden;overflow-y:auto;touch-action:pan-y}
.map-canvas.siblings-row{gap:8px;padding:8px;min-width:0;max-width:100%}
.siblings-row .branch-caption{height:54px;min-height:54px;padding:6px 7px;gap:0;border-radius:8px;text-align:center;justify-content:center}
.siblings-row .branch-caption strong{font-size:16px;text-align:center}
.siblings-row .branch-label small{font-size:10px;margin-top:4px;line-height:1.3}
.siblings-row .tile-count,.siblings-row .tile-arrow,.siblings-row .subtile small,.siblings-row .subtile .enter-symbol{display:none}
.siblings-row .branch-caption .tile-arrow{display:none}
.siblings-row .branch-children{padding:28px 4px 4px}
.siblings-row .branch-canvas{grid-template-rows:48px;gap:4px;max-width:100%}
.siblings-row .branch-canvas::before{right:calc(var(--first-son)/2);left:calc(var(--last-son)/2)}
.siblings-row .subtile{height:48px;min-height:48px;padding:5px 4px;gap:0;border-radius:7px;text-align:center;justify-content:center}
.siblings-row .subtile strong{font-size:var(--node-font,14px);line-height:1.4;text-align:center}
.siblings-row .branch-empty{margin:23px 0 0;padding:8px 2px;min-height:48px;font-size:10px;line-height:1.6}

/* All descendants remain visible; connector buses run between wrapped rows. */
.family-map{height:auto;min-height:0;overflow:visible}
.map-canvas.siblings-row{gap:20px 12px;align-items:start}
.siblings-row .branch-frame{padding:8px 4px 12px;border-radius:11px;background:#ffffff70;box-shadow:inset 0 0 0 1px var(--tile-border);isolation:isolate}
.siblings-row .branch-caption{z-index:2}
.siblings-row .branch-children{padding:30px 16px 0 0;z-index:1}
.siblings-row .branch-canvas{width:100%;display:grid;grid-auto-flow:row;grid-template-rows:none;grid-auto-rows:48px;gap:26px 6px}
.siblings-row .branch-children::before,.siblings-row .branch-canvas::before,.siblings-row .subtile::before{content:none;display:none}
.siblings-row .subtile{z-index:1}
.siblings-row .branch-empty{margin-top:30px;font-size:11px}
.family-connections{position:absolute;inset:0;width:100%;height:100%;color:var(--child-color);overflow:visible;pointer-events:none;z-index:0}
.family-connection{fill:none;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}
@media(max-width:820px){.site-header nav .desktop-tree-link{display:none}}

.mobile-map-controls{display:none}
.map-heading-actions{display:flex;gap:4px;align-items:center;flex-shrink:0}
.dense-tool{display:none}
.phone-tools-backdrop{position:fixed;inset:0;z-index:90;border:0;background:#11291f99}
/* On phones the tree owns the screen; supporting details open on request. */
@media(max-width:820px),(max-width:1100px) and (max-height:500px){
  html,body{width:100%;height:100%;height:100dvh;overflow:hidden;overscroll-behavior:none}
  body{display:flex;flex-direction:column}
  .site-header{flex:0 0 auto;width:100%;padding:4px max(6px,env(safe-area-inset-right)) 4px max(6px,env(safe-area-inset-left));gap:0;flex-wrap:nowrap}
  .site-header .brand,.site-header .private-label,.site-header .nav-active span{display:none}
  .site-header nav .desktop-tree-link{display:none}
  .site-header nav{display:grid;grid-template-columns:1fr 1fr 1.25fr;gap:3px;flex:1;min-width:0;overflow:visible;order:0}
  .site-header nav a{min-width:0;min-height:44px;padding:6px 4px;font-size:12px;justify-content:center;gap:0}
  main{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;width:100%;padding:6px max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));gap:6px}
  .intro,.family-sidebar,main>footer,.breadcrumbs,.relationship-key,.map-bottom,.map-tip,.map-toolbar>p,.map-heading .eyebrow{display:none}
  .app-status{position:absolute;width:1px;height:1px;min-height:0;margin:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .search-row{flex:0 0 44px;margin:0;gap:6px;min-width:0}
  .search-box{max-width:none;min-width:0}
  .search-box input{height:44px;padding:9px 37px 9px 40px;border-radius:9px;font-size:16px}
  .search-box>svg{width:19px;height:19px;right:11px;top:12px}
  .clear-search{top:0;left:0;height:44px}
  .search-results{max-height:min(340px,55dvh);overflow-x:hidden;overscroll-behavior:contain}
  .search-result small{overflow-wrap:anywhere}
  #rootButton{width:44px;height:44px;min-height:44px}
  .workspace{display:flex;flex:1;min-height:0;min-width:0;width:100%;gap:0}
  .map-panel{display:grid;grid-template-rows:44px 44px minmax(0,1fr) 44px;gap:6px;flex:1;min-height:0;min-width:0;width:100%;padding:6px;border-radius:12px;overflow:hidden}
  .map-heading{min-width:0;gap:6px}
  .map-heading>div{min-width:0}
  .map-heading h2{font-size:18px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .map-toolbar{min-width:0;margin:0;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;gap:0}
  .depth-switch{display:flex;flex:1;min-width:0;padding:0;gap:2px;border:0;background:none}
  .depth-switch button{flex:1;min-width:0;min-height:44px;padding:6px;font-size:12px;background:#f0f3e9}
  .family-map{--screen-padding:4;--screen-gap:12;--screen-base:54;--screen-row:66;height:100%;min-height:0;width:100%;overflow:hidden;border-radius:9px;touch-action:manipulation}
  .map-canvas.siblings-row{padding:4px;gap:12px;align-content:start}
  .siblings-row .branch-frame{padding:4px 2px 6px}
  .siblings-row .branch-caption{height:44px;min-height:44px;padding:4px;max-width:100%}
  .siblings-row .branch-label small,.siblings-row .branch-empty{display:none}
  .siblings-row .branch-children{padding:22px 16px 0 0}
  .siblings-row .branch-canvas{grid-auto-rows:44px;gap:22px 6px}
  .siblings-row .subtile{height:44px;min-height:44px}
  .mobile-map-controls{display:flex;align-items:center;min-width:0;gap:4px}
  .mobile-map-controls .icon-button{width:44px;height:44px;min-height:44px;font-size:21px}
  #mapPageStatus{flex:1;min-width:0;text-align:center;font-size:12px;font-weight:700;white-space:nowrap;font-variant-numeric:tabular-nums}
  #mobileProfileButton{flex-shrink:0;width:auto;height:44px;min-height:44px;padding:6px 10px;font-size:12px}
  .mobile-map-controls.single-page .icon-button,.mobile-map-controls.single-page #mapPageStatus{visibility:hidden}
  .app-error{padding:16px;margin:0;overflow:auto;min-height:0}
  .profile-overlay{padding:max(6px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))}
  .profile-dialog{height:100%;max-height:100%;border-radius:12px}
  .profile-dialog>header strong{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .profile-dialog>header button{flex-shrink:0}
}
@media(max-width:1100px) and (max-height:500px){
  .site-header{padding-top:0;padding-bottom:0;border-bottom:0}
  main{padding:4px;gap:4px}
  .map-panel{grid-template-rows:44px minmax(0,1fr) 44px;padding:4px;gap:4px}
  .map-toolbar{display:none}
  .family-map{--screen-padding:2;--screen-gap:8;--screen-base:48;--screen-row:60}
  .map-canvas.siblings-row{padding:2px;gap:8px 12px}
  .siblings-row .branch-frame{padding:2px 2px}
  .siblings-row .branch-children{padding-top:16px}
  .siblings-row .branch-canvas{row-gap:16px}
}

/* Crowded families retain the same parent-and-children grid on phones. */
@media(max-width:820px),(max-width:1100px) and (max-height:500px){
  .phone-dense .site-header,.phone-dense .search-row,.phone-dense .map-toolbar{display:none}
  .phone-dense main{padding:4px;gap:4px}
  .phone-dense .map-panel{grid-template-rows:44px minmax(0,1fr) 44px;padding:4px;gap:4px}
  .phone-dense .dense-tool{display:inline-flex}
  .siblings-row .branch-label strong{display:block;font-size:var(--parent-font,16px);line-height:1.2}
  .siblings-row .branch-label small{display:block;font-size:9px;line-height:1.1;margin-top:1px}
  .branch-page-note{margin:20px 2px 0;font-size:10px;line-height:1.4;text-align:center;color:var(--tile-ink)}
  .phone-compact main{padding:0;gap:0}
  .phone-compact .map-panel{padding:2px;gap:2px}
  .phone-compact .siblings-row .branch-frame{padding:2px}
  .phone-compact .siblings-row .branch-children{padding:12px 12px 0 0}
  .phone-compact .siblings-row .branch-canvas{grid-auto-rows:44px;gap:12px 6px}
  .phone-dense.phone-search-open .search-row{display:flex;position:fixed;top:max(6px,env(safe-area-inset-top));left:6px;right:6px;z-index:92;background:var(--paper);padding:4px;border-radius:12px}
  .phone-dense.phone-views-open .site-header{display:flex;position:fixed;top:max(6px,env(safe-area-inset-top));left:6px;right:6px;width:auto;z-index:92;border:1px solid var(--line);border-radius:12px}
  .phone-dense.phone-views-open .map-toolbar{display:flex;position:fixed;top:64px;left:6px;right:6px;z-index:92;padding:4px;min-height:52px;background:var(--paper);border-radius:12px}
}
