body{margin:0;padding:24px 28px 60px;background:var(--bg);color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
a{color:var(--accent)}
h1{font-size:22px;margin:0 0 4px}
h2{font-size:17px;margin:28px 0 8px;border-bottom:1px solid var(--line);padding-bottom:4px}
.intro,.life,.muted{color:var(--muted)}
.intro{max-width:820px;margin:0 0 12px}
.toolbar{display:flex;gap:8px;align-items:center;margin:12px 0 14px;flex-wrap:wrap}
.toolbar button{font:inherit;padding:4px 10px;border:1px solid var(--line);background:transparent;color:var(--ink);border-radius:4px;cursor:pointer}
ul.tree,ul.kids,ul.plain{list-style:none;margin:0;padding:0}
ul.kids{margin:2px 0 4px 10px;padding-left:16px;border-left:1px solid var(--line)}
ul.plain{list-style:disc;padding-left:22px}
.p{margin:2px 0;border-radius:4px;border-left:3px solid transparent}
.p>summary,.p>div.row{display:block;padding:7px 8px 7px 6px;cursor:pointer;list-style:none}
summary::-webkit-details-marker{display:none}
summary::before{content:"\25B8";display:inline-block;width:12px;color:var(--muted);font-size:11px;margin-right:2px}
details[open]>summary::before{content:"\25BE"}
.p.leaf{padding:7px 8px 7px 20px}
.p.main{border-left-color:var(--accent);background:var(--mainbg)}
.nm{font-weight:600}
.nm a{color:inherit;text-decoration:none}
.nm a:hover{text-decoration:underline}
.life{font-size:14px;margin-left:8px}
.sp{color:var(--muted);font-size:12px;margin-left:8px;font-style:italic}
.body{padding:2px 0 4px 14px}
.flag{font-size:11px;color:var(--warn);background:var(--warnbg);border-radius:3px;padding:0 5px;margin-left:8px}
.badge{font-size:11px;border-radius:3px;padding:0 5px;white-space:nowrap}a.badge{text-decoration:none}
.Confirmed{color:var(--ok);background:var(--okbg)}
.Probable{color:var(--info);background:var(--infobg)}
.Locked-hit{color:var(--warn);background:var(--warnbg)}
.Unsourced{color:var(--grey);background:var(--greybg)}
.banner{border:1px solid var(--warn);background:var(--warnbg);color:var(--ink);border-radius:4px;padding:8px 12px;margin:12px 0;max-width:820px}
table{border-collapse:collapse;width:100%;max-width:980px;font-size:15px}
th,td{text-align:left;vertical-align:top;padding:5px 8px;border-bottom:1px solid var(--line)}
th{color:var(--muted);font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.03em}
dl.rel{display:grid;grid-template-columns:max-content 1fr;gap:4px 14px;margin:8px 0;max-width:820px}
dl.rel dt{color:var(--muted)}
dl.rel dd{margin:0}
.wide{overflow-x:auto;max-width:100%}
.photos{display:flex;flex-wrap:wrap;gap:12px}
.photos figure{margin:0;max-width:260px}
.photos img{max-width:100%;height:auto;border:1px solid var(--line);border-radius:4px}
.photos figcaption{font-size:12.5px;color:var(--muted)}
#notes ol{padding-left:22px;max-width:920px}
#notes li{margin:6px 0}
footer{margin-top:32px;color:var(--muted);font-size:15px}
details.ev{margin:10px 0}details.ev>summary{cursor:pointer;color:var(--accent);padding:6px 0}
.key{max-width:820px}.key dt{font-weight:600}.key dd{margin:0 0 6px}
#find{font:inherit;font-size:18px;padding:12px 14px;border:1px solid var(--line);border-radius:4px;background:var(--bg);color:var(--ink);width:100%;max-width:420px;box-sizing:border-box;max-width:560px}
form.fix{max-width:560px;display:grid;gap:10px;margin-top:8px}form.fix label{display:grid;gap:4px;color:var(--muted)}form.fix textarea,form.fix input{font:inherit;padding:8px 10px;border:1px solid var(--line);border-radius:4px;background:var(--bg);color:var(--ink)}form.fix button{justify-self:start;font:inherit;padding:8px 16px;border:1px solid var(--accent);border-radius:4px;background:var(--mainbg);color:var(--ink);cursor:pointer;min-height:40px}
.lead{font-size:18px;max-width:760px;margin:4px 0 18px}
.statline{color:var(--muted);font-size:14px;margin:24px 0}
@media (max-width:640px){body{padding:16px}h1{font-size:20px}h2{font-size:16px}.lead{font-size:16px}.life{display:block;margin-left:0}dl.rel{grid-template-columns:1fr}td,dd,li,figcaption,.intro{overflow-wrap:anywhere}ul.kids{margin-left:2px;padding-left:10px}.body{padding-left:6px}.toolbar button{padding:8px 12px;min-height:40px}.toolbar label{padding:6px 0}.photos figure{max-width:100%;flex:1 1 100%}table.facts td:nth-child(3),table.facts td:nth-child(4){display:inline-block;margin-right:10px}table.facts,table.facts tbody,table.facts tr,table.facts td{display:block;width:auto}table.facts thead{display:none}table.facts tr{border-bottom:1px solid var(--line);padding:6px 0}table.facts td{border:0;padding:2px 0}table.facts td:first-child{font-weight:600;color:var(--muted)}}
#chart{display:block;width:100%;height:calc(100vh - 200px);min-height:340px;border:1px solid var(--line);border-radius:4px;background:var(--bg);cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
.ln{fill:none;stroke:var(--line);stroke-width:1.5}
.ln.mar{stroke-width:5}
.ln.mar2{stroke:var(--bg);stroke-width:1.6}
.ln.par{stroke:var(--accent);stroke-width:2.5;stroke-dasharray:0.1 5;stroke-linecap:round}
.zoom{display:inline-flex;gap:8px;white-space:nowrap}
details.help{margin:4px 0 8px;max-width:820px}details.help>summary{cursor:pointer;color:var(--accent);padding:4px 0}
@media (max-width:640px){#chart{border-radius:0;margin:0 -16px;width:calc(100% + 32px);border-left:0;border-right:0}.toolbar{gap:6px;margin:6px 0}.toolbar #focus{flex-basis:100%}}
.box rect{fill:var(--bg);stroke:var(--line)}
.box.focus rect{fill:var(--mainbg);stroke:var(--accent);stroke-width:2}
.box a{text-decoration:none}
.box text{font-size:13px}
.box text.nm{fill:var(--ink);font-weight:600}
.box text.lf{fill:var(--muted);font-size:11.5px}
.box text.fl{fill:var(--warn);font-size:11px}
.box .ring{fill:none;stroke:var(--line);stroke-width:2}
.topnav{display:flex;align-items:center;gap:2px;flex-wrap:wrap;margin:-12px 0 16px;padding:0 0 6px;border-bottom:1px solid var(--line)}
.topnav>a{padding:8px 12px;border-radius:4px;text-decoration:none;color:var(--ink)}
.topnav>a:hover{background:var(--mainbg)}.topnav>a.on{color:var(--accent);font-weight:600}
@media (max-width:640px){.topnav{position:fixed;left:0;right:0;bottom:0;z-index:2000;margin:0;flex-wrap:nowrap;background:var(--bg);border-bottom:0;border-top:1px solid var(--line);padding:4px 6px calc(4px + env(safe-area-inset-bottom));box-shadow:0 -1px 6px var(--shade)}.topnav>a{flex:1;text-align:center;padding:10px 2px;font-size:14px}body{padding-bottom:calc(76px + env(safe-area-inset-bottom))}}
.welcome{font-size:18px;max-width:760px}.welcome p{margin:0 0 10px}
.hello{display:flex;gap:16px;align-items:flex-start;max-width:760px}.hello>div{min-width:0}.hello p{margin:0 0 8px}
.hello img.owner{width:96px;height:96px;object-fit:cover;object-position:top;border-radius:50%;flex:none;border:1px solid var(--line)}
.hello .byline,.hello .private{color:var(--muted);font-size:14px}.hello .share{font-weight:600}
.fcard.start{max-width:520px}.fcard.start:hover{transform:none;box-shadow:none;border-color:var(--line)}.fcard.start a strong{color:var(--accent)}
@media (max-width:640px){.hello{flex-direction:column;gap:10px}.hello img.owner{width:72px;height:72px}}
.stat{border:1px solid var(--line);border-radius:6px;padding:10px 12px}.stat b{display:block;font-size:22px;color:var(--main)}.stat span{color:var(--muted);font-size:14px}
.feat{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px;max-width:980px}
.fcard{display:flex;gap:12px;align-items:flex-start;border:1px solid var(--line);border-radius:6px;padding:12px;color:var(--ink);text-decoration:none}
.fcard img{width:72px;height:72px;object-fit:cover;object-position:top;border-radius:50%;flex:none;border:1px solid var(--line)}
.fcard strong{color:var(--accent)}.fcard .life{margin-left:6px}.fcard p{margin:4px 0 0;font-size:14px;color:var(--muted)}
.fcard:hover strong{text-decoration:underline}
ul.recent{list-style:none;padding:0;margin:0;max-width:820px}ul.recent li{padding:6px 0;border-bottom:1px solid var(--line)}

/* ---- Käytettävyys ja ilme (UI/UX) ---- */
:root{color-scheme:light dark;--radius:8px;--ctl:38px}
:root[data-theme="light"]{color-scheme:light}:root[data-theme="dark"]{color-scheme:dark}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*{transition:none!important;animation:none!important}}
body{line-height:1.6;text-rendering:optimizeLegibility}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
a{text-underline-offset:2px;text-decoration-thickness:1px}
a:hover{text-decoration-thickness:2px}
h1{font-size:26px;line-height:1.25;margin:4px 0 8px}
h2{font-size:18px;margin:32px 0 10px}
::selection{background:var(--mainbg)}

/* hyppylinkki ja valikko */
.skip{position:absolute;left:-9999px;top:8px;background:var(--bg);color:var(--ink);border:2px solid var(--accent);border-radius:var(--radius);padding:8px 14px;z-index:3000}
.skip:focus{left:12px}
@media (min-width:641px){
  .topnav{position:sticky;top:0;z-index:1500;margin:-24px -28px 20px;padding:6px 28px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.4) blur(8px);-webkit-backdrop-filter:saturate(1.4) blur(8px)}
}
.topnav>a{border-radius:var(--radius);transition:background .15s,color .15s;position:relative}
.topnav>a.on::after{content:"";position:absolute;left:12px;right:12px;bottom:2px;height:2px;border-radius:2px;background:var(--accent)}

/* lomakkeen osat: samannäköiset napit, valinnat ja kentät */
button,select,input[type=search],input:not([type]),textarea{font:inherit;color:var(--ink)}
.toolbar button,.mapbar button,.toolbar select,.mapbar select{min-height:var(--ctl);padding:0 14px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);cursor:pointer;transition:background .15s,border-color .15s}
.toolbar button:hover,.mapbar button:hover,.toolbar select:hover,.mapbar select:hover{background:var(--mainbg);border-color:var(--accent)}
.toolbar button:active,.mapbar button:active{transform:translateY(1px)}
.toolbar select,.mapbar select{padding:0 10px}
.toolbar label,.mapbar label{display:inline-flex;align-items:center;gap:8px;min-height:var(--ctl)}
.toolbar input[type=checkbox]{width:18px;height:18px;accent-color:var(--accent);cursor:pointer;margin:0}
.toolbar{gap:10px 12px}
.zoom{gap:6px}
.zoom button:nth-child(1),.zoom button:nth-child(2){min-width:var(--ctl);padding:0;font-size:18px;font-weight:600}
#focus{font-weight:600}
#find{border-radius:var(--radius);padding:14px 16px;box-shadow:0 1px 2px var(--shade)}
#find:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 30%,transparent)}
form.fix textarea:focus,form.fix input:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 30%,transparent)}
form.fix button{border-radius:var(--radius);transition:background .15s}
form.fix button:hover{background:var(--main);color:var(--bg)}

/* kortit ja luettelot */
.card,.fcard,.stat,.tales li{border-radius:var(--radius);transition:transform .15s,box-shadow .15s,border-color .15s}
.card:hover,.fcard:hover,.tales li:hover{transform:translateY(-2px);box-shadow:0 4px 14px var(--shade);border-color:var(--accent)}
.tales li{background:color-mix(in srgb,var(--bg) 94%,var(--ink))}
.stat b{font-variant-numeric:tabular-nums}
ul.recent li:hover{background:var(--mainbg)}

/* sukupuun lista */
.p{border-radius:var(--radius)}
.p>summary:hover,.p>div.row:hover{background:var(--mainbg)}
.p>summary{border-radius:var(--radius)}

/* henkilösivu: taulukot */
table.facts{border:1px solid var(--line);border-radius:var(--radius);border-collapse:separate;border-spacing:0;overflow:hidden}
table.facts th{background:var(--greybg)}
table.facts tr:last-child td{border-bottom:0}
table.facts tbody tr:hover td{background:var(--mainbg)}
table.facts td:first-child{white-space:nowrap;color:var(--muted)}
.badge{padding:1px 7px;border-radius:10px}
dl.rel dt{font-size:14px;padding-top:1px}
.photos img{transition:transform .15s}
.photos a:hover img{transform:scale(1.02)}
details.ev>summary,details.help>summary{border-radius:6px}
details.help{border:1px solid var(--line);border-radius:var(--radius);padding:2px 12px;background:color-mix(in srgb,var(--bg) 94%,var(--ink))}
details.help[open]{padding-bottom:6px}
.banner{border-radius:var(--radius)}

/* kaavio ja kartta */
#chart{border-radius:var(--radius)}
.box rect{transition:stroke .15s,fill .15s}
.box:hover rect{stroke:var(--accent)}
.box{cursor:pointer}
#map,.chron{border-radius:var(--radius)}
.chron li{border-radius:6px;transition:background .15s}
.mapbar input[type=range]{height:28px}
footer{border-top:1px solid var(--line);padding-top:16px}

@media (max-width:640px){
  body{padding-top:14px}
  .toolbar button,.mapbar button,.toolbar select,.mapbar select{min-height:44px}
  .toolbar label{min-height:44px}
  .card:hover,.fcard:hover,.tales li:hover{transform:none;box-shadow:none}
  table.facts{border:0}
  table.facts td:first-child{white-space:normal}
}
@media print{.topnav,.toolbar,.mapbar,.skip,footer form{display:none}body{padding:0}}

/* Relationship calculator (relation.html) and ancestor fan chart (fan.html) */
.pick{display:flex;gap:10px 16px;align-items:end;flex-wrap:wrap;margin:14px 0}
.pick label{display:flex;flex-direction:column;gap:4px;font-size:14px;color:var(--muted)}
.pick select,.pick button{min-height:var(--ctl);padding:0 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);cursor:pointer;max-width:100%}
.pick select{min-width:260px}
.pick button:hover,.pick select:hover{background:var(--mainbg);border-color:var(--accent)}
#rel-result{max-width:820px;margin:18px 0}
#rel-result .verdict{font-size:22px;line-height:1.35;margin:0 0 6px}
#rel-result .verdict b.rel{color:var(--main)}
#rel-result .how{color:var(--muted);margin:0 0 16px}
ol.rpath{list-style:none;margin:0;padding:0;max-width:520px;position:relative}
ol.rpath li{position:relative;padding:8px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);margin:0}
ol.rpath li.end{border-color:var(--accent);background:var(--mainbg)}
ol.rpath li.top{border-style:dashed;border-color:var(--ok);background:var(--okbg)}
ol.rpath li .y{color:var(--muted);margin-left:6px;font-size:14px}
ol.rpath li .tag{float:right;font-size:12px;color:var(--ok);padding-top:2px}
ol.rpath li.step{border:0;background:none;padding:2px 0 2px 22px;color:var(--muted);font-size:13px;display:flex;align-items:center;gap:6px}
ol.rpath li.step::before{content:"";width:2px;height:20px;background:var(--line);margin-right:10px}
.fanwrap{overflow-x:auto;border:1px solid var(--line);border-radius:4px;background:var(--bg)}
#fan{display:block;width:100%;min-width:760px;height:auto}
#fan .w{cursor:pointer;stroke:var(--bg);stroke-width:1.5;transition:filter .12s,stroke-width .12s;animation:fanin .45s ease both}
#fan .w:hover{filter:brightness(1.12) saturate(1.3);stroke-width:2.5}
#fan .w{fill:var(--wf)}#fan .w.gap{fill:none;stroke:var(--line);stroke-dasharray:4 4;cursor:default}
#fan text{pointer-events:none;fill:var(--ink);font-family:inherit;animation:fanin .45s ease both}
#fan text.q{fill:var(--muted)}
#fan .root{fill:var(--mainbg);stroke:var(--accent);stroke-width:2}
#fan path,#fan circle{vector-effect:non-scaling-stroke}  /* lines and dashes stay the same on screen when zooming in */
@keyframes fanin{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){#fan .w,#fan text{animation:none}}
#fan.twin,#fan .w.twin{filter:brightness(1.3) saturate(1.5)}
/* fan and map pages: the chart fills the screen below the app bar, edge to edge, and the page does not scroll (100dvh follows a phone's moving address bar) */
html:has(body.fan-page),html:has(body.map-page){height:100%;overflow:hidden}
body.fan-page,body.map-page{height:100vh;height:100dvh;overflow:hidden;overscroll-behavior:none;display:flex;flex-direction:column}
.fan-page .appbar,.map-page .appbar{flex:none;position:relative}
.fan-page main,.map-page main{flex:1 1 auto;min-height:0;width:100%;max-width:none;padding:0;position:relative}
.fanbox{position:absolute;inset:0;overflow:hidden;touch-action:none}
.fanwrap.fit{position:absolute;inset:0;overflow:hidden;border:0;border-radius:0;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
#fan:focus-visible,#chart:focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
.fanwrap.fit.drag{cursor:grabbing}
.fanwrap.fit #fan{width:100%;height:100%;min-width:0}
/* fan page overlays: title and count top left, help and settings top right, the person card bottom left, the zoom controls bottom right */
.fanhead{position:absolute;top:8px;left:8px;right:8px;z-index:3;display:flex;align-items:flex-start;justify-content:space-between;gap:8px;pointer-events:none}
.fanhead h1{min-width:0;margin:0;padding:5px 10px;font-size:16px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:color-mix(in srgb,var(--surface) 90%,transparent);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow-1)}
.fanhead h1 .count{font-size:12px;margin-left:0}
.fanhead-left{min-width:0;display:flex;align-items:stretch;gap:6px}
.fanhead-left .maptool{flex:none;width:36px;height:auto;min-height:0;border-radius:10px;pointer-events:auto;box-shadow:var(--shadow-1)}
.fanhead-left .maptool svg{width:18px;height:18px}
.fanhead-left .maptool[hidden]{display:none}
.fanhead-btns{position:relative;flex:none;display:flex;gap:6px;pointer-events:auto}
.fanhead .fan-options{position:static}
.fanhead .fan-options>summary,.fanhead .maptool{box-shadow:var(--shadow-1)}
.fanhead .fan-options>div{max-height:calc(100vh - var(--appbar-h,60px) - 74px);max-height:calc(100dvh - var(--appbar-h,60px) - 74px);overflow:auto;overscroll-behavior:contain;touch-action:pan-y}
.fan-help>div{width:min(420px,calc(100vw - 16px));font-size:14px;color:var(--ink)}
.fan-help h2{margin:0;font-size:17px}
.fan-help .intro{margin:0;line-height:1.5}
.fan-help #fan-cover{margin:0}
.fan-options{position:relative;flex:none}
.fan-options>summary,.maptool{list-style:none;padding:0;display:flex;align-items:center;justify-content:center;width:44px;height:44px;box-sizing:border-box;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);color:var(--muted);cursor:pointer}
.fan-options>summary::-webkit-details-marker,.fan-options>summary::before{display:none}
.fan-options>summary:hover,.fan-options[open]>summary,.maptool:hover,.maptool[aria-expanded="true"]{color:var(--ink);border-color:var(--accent)}
.fan-options>summary svg,.maptool svg{width:20px;height:20px}
.fan-options>div{position:absolute;right:0;top:calc(100% + 6px);z-index:1000;width:280px;max-width:calc(100vw - 32px);box-sizing:border-box;display:flex;flex-direction:column;gap:12px;padding:14px;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-2)}
.fan-options label{display:flex;flex-direction:column;gap:4px;font-size:14px;color:var(--muted)}
.fan-options label.unc{flex-direction:row;color:var(--ink);min-height:44px}
.fan-options input[type=checkbox]{width:20px;height:20px;margin:0}
.fan-options select{min-height:44px;padding:0 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);color:var(--ink);font:inherit;cursor:pointer}
.fanbox #fan-info,.fanbox .treefoot{position:absolute;left:8px;bottom:8px;z-index:2;max-width:min(320px,calc(100% - 226px));height:auto;min-height:0;max-height:none;margin:0;padding:6px 10px;font-size:13px;line-height:1.35;background:color-mix(in srgb,var(--surface) 92%,transparent);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow-1)}
.fanctl{position:absolute;right:10px;bottom:10px;z-index:2;display:flex;gap:2px;padding:3px;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-1);cursor:default}
.fanctl button{display:flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:9px;background:none;color:var(--ink);font:inherit;font-size:22px;line-height:1;cursor:pointer}
.fanctl button:hover{background:var(--surface-2)}
.fanctl svg{width:20px;height:20px}
/* phones: the zoom controls stand in a column at the right edge, so the person card gets the rest of the bottom row */
@media (max-width:640px){.fanctl{flex-direction:column;right:8px;bottom:8px}.fanbox #fan-info,.fanbox .treefoot{max-width:calc(100% - 80px)}}
.repchip{display:inline-block;border:2px solid;border-radius:4px;padding:0 6px;margin:2px 2px;color:var(--ink)}
#fan.hl-unc .w:not(.prob):not(.guess):not(.gap),#fan.hl-unc text.lbl:not(.prob){filter:grayscale(1) opacity(.28)}
#fan.hl-unc .w.prob{stroke:var(--unc-prob);stroke-width:2.5;stroke-dasharray:6 4;filter:brightness(1.2) saturate(1.4)}
#fan.hl-unc .w.guess{stroke:var(--unc-guess);stroke-width:3;stroke-dasharray:2 5;stroke-linecap:round;fill:var(--unc-guess-fill);filter:saturate(1.5)}
#fan.hl-unc text.lbl.guess{fill:var(--unc-guess-ink);font-weight:700;filter:none}
.guesschip{display:inline-block;border:2px dotted var(--unc-guess);border-radius:4px;padding:0 6px;margin:2px 2px;color:var(--ink)}
#chart.hl-unc .ln:not(.dash){opacity:.22}
#chart .ln.dash{stroke:var(--line-2);stroke-dasharray:6 4}
#chart.hl-unc .ln.dash{stroke:var(--accent);stroke-width:3.5;stroke-dasharray:7 4}
label.unc,.pick label.unc{display:inline-flex;flex-direction:row;min-height:var(--ctl);align-items:center;gap:6px;cursor:pointer}
#fan-info{height:5.4em;overflow:hidden;margin:10px 0;line-height:1.35}
#fan-cover{display:flex;flex-direction:column;gap:4px;color:var(--muted);font-size:14px;margin:8px 0 20px}
#fan-cover b{color:var(--ink)}
.byear{font-weight:400;color:var(--muted);font-size:.6em}
.sbs{display:grid;grid-template-columns:1fr 1fr;gap:8px 28px;align-items:start}.sbs>section{min-width:0}.sbs-fan .fanwrap,.sbs-map #pmap{height:480px!important;box-sizing:border-box;max-width:none}@media(max-width:900px){.sbs{grid-template-columns:1fr}}
.fanwrap.small #fan{min-width:0;width:100%;height:100%}.sbs-fan .pick select{min-width:0;flex:1}.sbs-fan .pick label:not(.unc){flex:1 1 140px}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.count{font-size:.5em;font-weight:400;color:var(--muted);margin-left:.6em;white-space:nowrap}
.topnav .updated{margin-left:auto;padding:0 6px;color:var(--muted);font-size:13px;white-space:nowrap}
@media (max-width:640px){.topnav .updated{display:none}}

/* Family explorer */
.tree-search{flex:1;min-width:240px}.tree-search input{width:100%;min-width:150px;padding:10px 12px;font:inherit;color:var(--ink);background:var(--bg);border:1px solid var(--line);border-radius:8px}
#chart{background-color:var(--bg);background-image:radial-gradient(var(--line) .7px,transparent .7px);background-size:22px 22px;border-radius:12px;min-height:400px}
#tree-overview{position:absolute;right:14px;bottom:14px;width:200px;height:120px;background:var(--bg);border:1px solid var(--line);border-radius:8px;cursor:crosshair;box-shadow:0 2px 10px var(--shade)}
#chart .box:hover,#chart .box:focus{opacity:1}#chart .box:focus rect{stroke:var(--accent);stroke-width:3}#chart .family-edge{stroke:var(--ink);stroke-width:2.5}#chart .partner{stroke:var(--grey);stroke-dasharray:2 5}.tree-help{font-size:13px;color:var(--muted);margin:10px 0;line-height:1.8}
#chart .box text.nm{font-size:14px}#chart .box text.lf{font-size:12px}
/* Hover tracing keeps the viewport still and follows parent links only. */
#chart [data-branch="1"]{--path-color:var(--side-f)}#chart [data-branch="2"]{--path-color:var(--side-m)}#chart [data-branch="3"]{--path-color:var(--side-both)}
#chart.tracing .ln:not(.path-active){opacity:.16}#chart.tracing .box:not(.path-active){opacity:.35}
#chart.tracing .box.path-active{opacity:1}#chart.tracing .box.path-active rect{stroke:var(--path-color);stroke-width:3}
#chart.tracing .ln.path-active{stroke:var(--path-color);stroke-width:3.5;opacity:1}
/* A fixed-height explorer: only the graph pans, the page never scrolls. */
.kin-legend>div{position:absolute;left:0;bottom:calc(100% + 8px);z-index:5;width:420px;max-width:calc(100vw - 48px);max-height:calc(100dvh - var(--appbar-h,60px) - 160px);overflow:auto;overscroll-behavior:contain;touch-action:pan-y;box-sizing:border-box;padding:12px;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-2)}
.kin-legend{flex:none;font-size:12px}.kin-legend summary{display:flex;flex-wrap:wrap;gap:4px 10px;cursor:pointer;list-style:none}.kin-legend summary::before{display:none}.kin-legend summary span{border-bottom:3px solid var(--kin-color);white-space:nowrap}.kin-legend>div{width:420px;line-height:1.6}
/* Kinship to the selected person (chart.js kinshipFrom): one colour, strong for the direct line, lighter for other relatives, grey by marriage. */
[data-kin="line"]{--kin-color:var(--kin-line)}[data-kin="kin"]{--kin-color:var(--kin-other)}[data-kin="marriage"]{--kin-color:var(--kin-marriage)}[data-kin="none"]{--kin-color:var(--line-2)}
#chart .box[data-kin] rect{stroke:var(--kin-color);stroke-width:2.5}#chart .box[data-kin="line"] rect{stroke-width:3}#chart .box[data-kin="none"]{opacity:.5}#chart .box[data-kin="none"] rect{stroke:var(--line);stroke-width:1}
#chart .box.focus rect{fill:var(--mainbg);stroke:var(--accent);stroke-width:3}
.kin-legend summary span[data-kin="none"]{border-bottom-style:dotted;color:var(--muted)}

/* ---- Mobile (phone) tuning ---- */
@media (max-width:640px){
  html{-webkit-tap-highlight-color:transparent}
  body:not(.tree-page){overflow-x:hidden}
  select,input,textarea,button{max-width:100%}
  select,input[type=search],input:not([type]),textarea{font-size:16px}  /* 16px stops iOS zooming into a field on focus */
  h1{font-size:22px}
  /* bottom bar: seven short labels must fit without clipping; scroll sideways if the phone is very narrow */
  .topnav{overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .topnav::-webkit-scrollbar{display:none}
  .topnav>a{flex:1 0 auto;font-size:11.5px;padding:12px 3px;white-space:nowrap}
  .topnav>a.on::after{left:6px;right:6px}
  /* controls: a two-column grid */
  .pick{display:grid;grid-template-columns:1fr 1fr;gap:8px 10px;align-items:end;margin:8px 0}
  .pick label{min-width:0}
  .pick:has(#a) label,.pick:has(#a) button{grid-column:1/-1;min-height:44px}
  .pick:has(#a) select{min-height:44px}
  .pick select{min-width:0;width:100%}
  .pick label.unc{grid-column:1;min-height:44px}
  #fan-info{height:auto;min-height:3.4em;max-height:6em;font-size:15px;margin:6px 0}
  /* person page: side-by-side fan and map become a stack of shorter boxes */
  .sbs-fan .fanwrap,.sbs-map #pmap{height:340px!important}
  .mapbar{gap:8px}
  .mapbar button{flex:1 1 40%}
  .mapbar label{flex:1 1 100%;display:flex;align-items:center;gap:10px}
  .mapbar label select{flex:1;min-width:0}
  /* wide tables scroll instead of widening the page */
  table:not(.facts){display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
  /* lists and forms */
  .welcome{font-size:17px}
  .fcard img{width:56px;height:56px}
  #find{max-width:none}
  .tales li{padding:12px}
  .pick select{min-width:0}
  #rel-result .verdict{font-size:19px}
  ol.rpath{max-width:none}
  details.help{padding:2px 10px}
  footer{margin-top:24px}
}
