:root{
  --bg:#f5f7f6;--surface:#fff;--surface2:#edf5f1;--text:#1f2933;--muted:#667085;
  --line:#d8e1dc;--brand:#185c4b;--brand2:#2f7d68;--warn:#9a6700;--danger:#b42318;
  --shadow:0 10px 28px rgba(25,45,36,.08);--radius:16px;
}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;color:var(--text);background:var(--bg)}
button,input,select,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}
.shell{display:grid;grid-template-columns:260px 1fr;min-height:100vh}.sidebar{background:#123f35;color:#fff;padding:24px 18px;position:sticky;top:0;height:100vh}.brand{font-weight:800;font-size:20px;line-height:1.35}.brand small{display:block;font-weight:500;opacity:.75;font-size:12px;margin-top:5px}.nav{margin-top:26px;display:grid;gap:8px}.nav button{border:0;text-align:left;background:transparent;color:#eaf5f1;padding:11px 12px;border-radius:10px}.nav button.active,.nav button:hover{background:rgba(255,255,255,.12)}.sidebar-foot{position:absolute;bottom:20px;left:18px;right:18px;font-size:11px;opacity:.7}
.main{min-width:0}.topbar{background:rgba(255,255,255,.92);backdrop-filter:blur(8px);border-bottom:1px solid var(--line);padding:14px 24px;display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;z-index:20}.topbar strong{font-size:16px}.top-actions{display:flex;gap:8px;flex-wrap:wrap}.content{padding:24px;max-width:1280px;margin:auto}.page-title{font-size:26px;margin:0 0 6px}.lead{color:var(--muted);margin:0 0 20px}.grid{display:grid;gap:18px}.grid-2{grid-template-columns:1fr 1fr}.grid-3{grid-template-columns:repeat(3,1fr)}.card{background:var(--surface);border:1px solid #e7ece9;border-radius:var(--radius);box-shadow:var(--shadow);padding:20px}.card h2,.card h3{margin-top:0}.metric{font-size:32px;font-weight:800;color:var(--brand)}.muted{color:var(--muted)}.notice{padding:14px 16px;border-radius:12px;background:#fff8e6;border:1px solid #f4d48a;color:#7a5100;margin-bottom:18px}.notice.danger{background:#fff1f0;border-color:#f7b4ae;color:#8f1b13}
.btn{border:0;border-radius:10px;padding:10px 14px;font-weight:700}.btn.primary{background:var(--brand);color:#fff}.btn.secondary{background:#edf2f0;color:#27423a}.btn.outline{background:#fff;border:1px solid var(--line);color:#344054}.btn.danger{background:#fee4e2;color:var(--danger)}.btn.small{padding:7px 10px;font-size:13px}.actions{display:flex;gap:8px;flex-wrap:wrap}
label{display:block;font-size:13px;font-weight:700;margin:12px 0 6px}.field-help{font-size:12px;color:var(--muted);margin-top:5px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.span-2{grid-column:span 2}input,select,textarea{width:100%;border:1px solid #cfd9d4;border-radius:10px;padding:10px 11px;background:#fff}input:focus,select:focus,textarea:focus{outline:3px solid #d7eee6;border-color:var(--brand2)}
.list{display:grid;gap:10px}.person-row{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;border:1px solid var(--line);padding:13px;border-radius:12px;background:#fff}.person-row strong{display:block}.tag{display:inline-block;border-radius:999px;background:var(--surface2);color:var(--brand);padding:4px 8px;font-size:12px;margin:4px 4px 0 0}.tag.red{background:#fee4e2;color:var(--danger)}.tag.black{background:#111827;color:#fff}.tag.gray{background:#eef0f3;color:#475467}.tag.yellow{background:#fff4cc;color:#7a5100}
.tree-wrap{overflow:auto;background:#fbfcfb;border:1px solid var(--line);border-radius:14px;min-height:520px}.tree-svg{display:block;min-width:1100px}.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--muted);margin-top:12px}.legend span:before{content:"";display:inline-block;width:12px;height:12px;border:2px solid #667085;margin-right:5px;vertical-align:-2px}.legend .female:before{border-radius:50%}.legend .affected:before{background:#ffe4e1}.legend .deceased:before{background:#111827;border-color:#111827}.legend .nonblood:before{border-style:dashed;background:#fff}
.flag{padding:13px 14px;border-radius:12px;border:1px solid #f0c36a;background:#fff7e5;color:#815700}.flag.ok{border-color:#a8dfc4;background:#edf9f3;color:#176448}.flag + .flag{margin-top:10px}.report-section{border-top:1px solid var(--line);padding-top:16px;margin-top:16px}.report-section:first-child{border-top:0;padding-top:0;margin-top:0}.report-table{width:100%;border-collapse:collapse}.report-table th,.report-table td{border-bottom:1px solid var(--line);padding:9px;text-align:left;font-size:14px}.status{font-weight:800}.status.high{color:var(--danger)}.status.mid{color:var(--warn)}.status.low{color:#176448}
.empty{text-align:center;color:var(--muted);padding:48px 20px}.stepper{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0 22px}.step{background:#edf2f0;border-radius:999px;padding:7px 11px;font-size:12px;color:#52635d}.step.active{background:var(--brand);color:#fff}.footer-note{font-size:12px;color:var(--muted);margin-top:20px}
@media(max-width:900px){.shell{grid-template-columns:1fr}.sidebar{position:static;height:auto}.sidebar-foot{display:none}.nav{grid-template-columns:repeat(3,1fr)}.nav button{text-align:center;font-size:12px}.grid-2,.grid-3,.form-grid{grid-template-columns:1fr}.span-2{grid-column:auto}.topbar{position:static;padding:12px 16px}.content{padding:16px}.page-title{font-size:22px}}
@media print{.sidebar,.topbar,.no-print{display:none!important}.shell{display:block}.content{padding:0;max-width:none}.card{box-shadow:none;border:0}.tree-wrap{overflow:visible;border:0}.page-title{font-size:22px}}

.row-actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}.editing-row{outline:2px solid #2f806b;background:#f0faf6}.person-row{align-items:center}


.tree-person{cursor:pointer;outline:none}
.tree-person:hover>*:first-child,.tree-person:focus>*:first-child{filter:drop-shadow(0 0 7px rgba(24,92,75,.55));stroke:#185c4b!important}
.tree-action-panel{margin-top:16px;border:2px solid #d7ebe4}

.line-cta{margin-top:18px;border:1px solid #b7e4c7;background:linear-gradient(135deg,#f3fff7,#ffffff);display:flex;align-items:center;justify-content:space-between;gap:20px}.line-cta h2{margin:6px 0 8px}.line-cta p{margin:0;max-width:760px}.line-btn{background:#06c755!important;color:#fff!important;border-color:#06c755!important;font-weight:800}.line-btn:hover{filter:brightness(.96)}@media(max-width:760px){.line-cta{display:block}.line-cta .line-btn{display:block;margin-top:14px;text-align:center;width:100%}}


/* Version 4 Gold Edition */
:root{--bg:#f8f6f1;--surface:#fff;--surface2:#f6efe1;--text:#242424;--muted:#726d64;--line:#e5dccd;--brand:#b78425;--brand2:#d7ad52;--shadow:0 16px 45px rgba(67,48,18,.09);--radius:20px}
html,body{background:radial-gradient(circle at 100% 0,#fff8e9 0,transparent 33%),var(--bg)}
.sidebar{background:linear-gradient(180deg,#171717 0%,#29251e 100%);padding:18px 16px;border-right:1px solid rgba(255,255,255,.08)}
.brand-image-wrap{display:block;background:#f3a214;border-radius:16px;overflow:hidden;box-shadow:0 12px 28px rgba(0,0,0,.25)}
.brand-image{width:100%;display:block;aspect-ratio:2.52/1;object-fit:cover}
.brand-copy{font-family:Georgia,"Noto Serif JP",serif;font-size:22px;color:#fff;margin:20px 8px 6px;letter-spacing:.03em}.brand-copy small{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;display:block;color:#d8c8a9;font-size:11px;margin-top:6px;font-weight:500;letter-spacing:.08em}
.nav{margin-top:20px}.nav button{color:#f5efe4;border:1px solid transparent}.nav button.active,.nav button:hover{background:linear-gradient(135deg,rgba(205,158,68,.28),rgba(255,255,255,.06));border-color:rgba(218,177,96,.33)}
.sidebar-line{display:block;margin-top:20px;padding:11px 12px;border-radius:999px;background:#06c755;color:#fff;text-align:center;text-decoration:none;font-size:13px;font-weight:800}
.sidebar-foot{color:#c9b895;opacity:.9}
.topbar{background:rgba(255,255,255,.84);border-color:#e9dfcf;box-shadow:0 8px 24px rgba(75,55,20,.04)}
.topbar strong,.page-title,h1,h2,h3{font-family:Georgia,"Noto Serif JP",serif;letter-spacing:.015em}
.page-title{font-weight:500;font-size:32px}.lead{font-size:16px;line-height:1.8}
.card{border-color:#ede4d6;box-shadow:var(--shadow)}
.metric{color:#a7771e;font-family:Georgia,"Times New Roman",serif;font-weight:500}
.notice{background:#fffaf0;border-color:#ead39e;color:#6d5521}
.btn{border-radius:999px}.btn.primary{background:linear-gradient(135deg,#a8751a,#dbb75f);box-shadow:0 8px 20px rgba(173,121,26,.18)}.btn.secondary{background:#f4ecde;color:#5e4b27}.btn.outline{border-color:#dfd4c2;color:#4d463c}.btn.outline:hover{background:#fff9ec}
input,select,textarea{border-color:#ddd3c3;background:#fffdfa}input:focus,select:focus,textarea:focus{outline:3px solid #f4e4bd;border-color:#c39842}
.tag{background:#f7efdf;color:#8b681e}.step.active{background:linear-gradient(135deg,#a8751a,#d9b55d)}
.tree-wrap{background:linear-gradient(180deg,#fff,#fcfaf5)}
.line-cta{border-color:#dbc387;background:linear-gradient(135deg,#fffaf0,#fff);position:relative;overflow:hidden}.line-cta:after{content:"";position:absolute;width:240px;height:240px;border-radius:50%;right:-110px;bottom:-150px;background:radial-gradient(circle,#f3d789,transparent 68%);opacity:.45;pointer-events:none}.line-cta>*{position:relative;z-index:1}
@media(max-width:900px){.sidebar{background:#1f1d19}.brand-image-wrap{max-width:330px}.brand-copy{margin-top:14px}.nav{grid-template-columns:repeat(3,1fr)}.sidebar-line{max-width:330px}.page-title{font-size:27px}}
@media print{html,body{background:#fff}.brand-image-wrap{display:none}}


/* Version 4.1 Mobile UI */
.tree-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.tree-view-switch,.tree-zoom-controls{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.tree-zoom-controls span{min-width:48px;text-align:center;font-size:12px;color:var(--muted)}
.tree-canvas{transform-origin:top left;transform:scale(var(--tree-zoom));width:max-content;min-height:calc(1280px * var(--tree-zoom));}
.tree-wrap.fit-view{overflow:hidden}.tree-wrap.fit-view .tree-canvas{transform:none;width:100%;min-height:auto}.tree-wrap.fit-view .tree-svg{min-width:0;width:100%;height:auto}
.tree-wrap.detail-view{overflow:auto;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y}.tree-mobile-hint{display:none;color:var(--muted);font-size:12px;margin-top:9px}
.mobile-generation-tree{padding:12px 8px 28px}.generation-block{position:relative;text-align:center;padding:0 0 30px}.generation-label{display:inline-block;background:#f6efe1;color:#71551e;border:1px solid #e0c98f;border-radius:999px;padding:6px 12px;font-size:12px;font-weight:800;margin-bottom:13px}.generation-connector{width:2px;height:24px;background:#8e8068;margin:-1px auto 8px}.generation-connector.first{display:none}.generation-cards{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;position:relative}.generation-cards:before{content:"";position:absolute;top:-9px;left:15%;right:15%;height:2px;background:#8e8068}.generation-person{position:relative;z-index:1;width:min(44%,180px);min-width:135px;border:2px solid #887b67;background:#fffdfa;border-radius:14px;padding:12px 8px;box-shadow:0 8px 18px rgba(52,39,18,.08);color:var(--text)}.generation-person:before{content:"";position:absolute;width:2px;height:10px;background:#8e8068;top:-11px;left:50%}.generation-person strong,.generation-person span,.generation-person em,.generation-person small{display:block}.generation-person strong{font-family:Georgia,"Noto Serif JP",serif;font-size:14px}.generation-person span{font-size:11px;color:var(--muted);margin-top:4px}.generation-person em{font-size:11px;color:#b42318;font-style:normal;margin-top:5px}.generation-person small{font-size:10px;color:#7a5100;margin-top:5px}.generation-person.deceased{background:#171717;color:#fff;border-color:#171717}.generation-person.deceased span,.generation-person.deceased em,.generation-person.deceased small{color:#fff}.generation-person.nonblood{border-style:dashed}
@media(max-width:760px){
  body{padding-bottom:72px}.shell{display:block}.sidebar{padding:10px 10px 8px;position:relative}.brand-image-wrap{max-width:230px;margin:auto}.brand-copy{text-align:center;font-size:18px;margin:10px 0 8px}.nav{position:fixed;left:0;right:0;bottom:0;z-index:100;background:rgba(24,22,19,.97);backdrop-filter:blur(10px);display:grid;grid-template-columns:repeat(6,1fr);gap:0;margin:0;padding:6px 4px calc(6px + env(safe-area-inset-bottom));box-shadow:0 -8px 28px rgba(0,0,0,.16)}.nav button{padding:8px 2px;font-size:10px;border-radius:8px;white-space:nowrap}.sidebar-line,.sidebar-foot{display:none}.topbar{position:sticky;top:0;padding:9px 10px;gap:8px}.topbar strong{font-size:13px}.top-actions{gap:5px;justify-content:flex-end}.top-actions .btn{font-size:10px;padding:7px 9px}.content{padding:12px}.card{padding:14px;border-radius:16px}.page-title{font-size:24px}.lead{font-size:14px;line-height:1.65}.person-row{display:block}.row-actions{margin-top:10px;justify-content:flex-start}.report-table{display:block;overflow-x:auto;white-space:nowrap}.tree-toolbar{display:block}.tree-view-switch{display:grid;grid-template-columns:repeat(3,1fr)}.tree-view-switch .btn{padding:9px 5px;font-size:11px}.tree-zoom-controls{justify-content:center;margin:10px 0}.tree-toolbar>.actions{justify-content:center;margin-top:10px}.tree-wrap{min-height:420px;max-height:68vh}.tree-wrap.fit-view{min-height:auto;max-height:none}.tree-wrap.detail-view{border-radius:12px}.tree-mobile-hint{display:block}.line-cta h2{font-size:21px}.line-cta p{font-size:13px;line-height:1.7}.generation-person{width:min(46%,170px);min-width:128px}.generation-cards:before{left:8%;right:8%}
}
@media(max-width:380px){.generation-person{width:100%;max-width:230px}.generation-cards:before{left:50%;right:auto;width:2px;height:100%;top:-9px}.generation-person:before{height:12px}.nav button{font-size:9px}.top-actions a{display:none}}

/* Version 4.2: relationship-based relative entry */
.relation-builder{border:1px solid rgba(201,148,46,.35);background:#fffaf0;border-radius:16px;padding:14px}
.relation-choice{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:8px}
.choice-card{display:flex!important;align-items:flex-start;gap:10px;border:1px solid #d7dce2;border-radius:13px;padding:12px;background:#fff;cursor:pointer;margin:0!important}
.choice-card:has(input:checked){border-color:#c9942e;box-shadow:0 0 0 3px rgba(201,148,46,.13);background:#fffdf8}
.choice-card input{width:auto;margin-top:3px}
.choice-card span{display:flex;flex-direction:column;gap:3px}
.choice-card strong{color:#172b25}
.choice-card small{color:#667085;font-weight:400;line-height:1.4}
@media(max-width:640px){.relation-choice{grid-template-columns:1fr}.choice-card{min-height:64px}}
.origin-status{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border:1px solid #e2d4b5;border-radius:12px;background:#fffaf0;color:#50411f}.origin-status.active{display:block}.origin-status.active strong{display:block;margin-bottom:4px}.origin-status span{font-size:12px;color:#776746}.origin-status strong{font-size:15px;color:#302713}@media(max-width:640px){.origin-status{align-items:flex-start;flex-direction:column;gap:4px}}

.private-risk{border-left-color:#b88a2a;background:#fff9e8}.risk-mini{display:block;margin-top:7px;padding:6px 8px;border-radius:8px;background:#fff6d9;color:#7a4d00;font-weight:700;line-height:1.35}.generation-person.deceased .risk-mini{background:rgba(255,255,255,.16);color:#fff}

.tag.green{background:#ecfdf3;color:#067647;border-color:#abefc6}
.gene-positive{color:#b42318!important;font-weight:800}
.gene-negative{color:#067647!important;font-weight:800}


/* Version 4.9.3: genetic inheritance color system */
.gene-legend{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:14px;padding:12px 14px;border:1px solid #e5e7eb;border-radius:12px;background:#fff}.gene-legend strong{width:100%;font-size:13px}.gene-legend .gl{font-size:12px;font-weight:800;padding:5px 10px;border-radius:999px;border:2px solid currentColor;background:#fff}.gene-legend .positive{color:#c62828;background:#fdecec}.gene-legend .negative{color:#138a52;background:#eaf8f0}.gene-legend .possible{color:#d97706;background:#fff4df}.gene-legend .untested{color:#64748b;background:#f1f5f9}.gene-legend small{width:100%;color:#667085;line-height:1.55}
.generation-person.gene-positive{border-color:#c62828!important;background:#fdecec}.generation-person.gene-negative{border-color:#138a52!important;background:#eaf8f0}.generation-person.gene-possible{border-color:#d97706!important;background:#fff4df}.generation-person.gene-untested,.generation-person.gene-unknown{border-color:#64748b!important;background:#f8fafc}.generation-person.deceased{background:#171717!important}.generation-person.gene-positive:after,.generation-person.gene-negative:after,.generation-person.gene-possible:after,.generation-person.gene-untested:after,.generation-person.gene-unknown:after{position:absolute;top:7px;right:7px;width:10px;height:10px;border-radius:50%;content:""}.generation-person.gene-positive:after{background:#c62828}.generation-person.gene-negative:after{background:#138a52}.generation-person.gene-possible:after{background:#d97706}.generation-person.gene-untested:after,.generation-person.gene-unknown:after{background:#64748b}

/* Version 5.0: target-gene inheritance visualization */
.gene-selector{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:800;color:#344054;background:#fffaf0;border:1px solid #e2d4b5;border-radius:10px;padding:7px 10px;margin:0}
.gene-selector select{width:auto;min-width:110px;margin:0;padding:7px 28px 7px 9px;border-radius:8px}
.gene-legend .other{color:#7c3aed;background:#f3e8ff}
.generation-person.gene-blocked{border-color:#138a52!important;background:#eaf8f0}
.generation-person.gene-other{border-color:#7c3aed!important;background:#f3e8ff}
.generation-person.gene-blocked:after,.generation-person.gene-other:after{position:absolute;top:7px;right:7px;width:10px;height:10px;border-radius:50%;content:""}
.generation-person.gene-blocked:after{background:#138a52}.generation-person.gene-other:after{background:#7c3aed}
.gene-target-positive,.gene-target-negative,.gene-target-blocked,.gene-target-possible,.gene-target-other,.gene-target-unknown{display:block;margin-top:7px;padding:6px 8px;border-radius:8px;font-weight:700;line-height:1.35}
.gene-target-positive{background:#fdecec;color:#b42318}.gene-target-negative,.gene-target-blocked{background:#eaf8f0;color:#067647}.gene-target-possible{background:#fff4df;color:#9a5b00}.gene-target-other{background:#f3e8ff;color:#6d28d9}.gene-target-unknown{background:#f1f5f9;color:#475569}
.generation-person.deceased [class^="gene-target-"]{background:rgba(255,255,255,.16);color:#fff}
@media(max-width:760px){.tree-toolbar{align-items:stretch}.gene-selector{width:100%;justify-content:space-between}.gene-selector select{flex:1;max-width:180px}}

.brand-alias{display:block;margin-top:4px;color:#b9821f;font-size:.92em;font-weight:800;letter-spacing:.08em}

/* Version 5.2 Release Candidate */
.input-error{border-color:#d92d20!important;box-shadow:0 0 0 3px rgba(217,45,32,.12)!important}
.field-error{color:#b42318;font-size:12px;font-weight:700;margin-top:5px}
.backup-actions{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}
.backup-status{padding:10px 12px;background:#f7f4ed;border:1px solid #e8dcc1;border-radius:10px;color:#6b5528;font-size:13px}
@media(max-width:640px){.backup-actions .btn{width:100%}}

/* Version 5.3: smartphone person-entry wizard */
@media(max-width:760px){
  body{padding-bottom:86px}
  .main{min-width:0}
  .content{padding:12px}
  .topbar{gap:8px;align-items:flex-start}
  .top-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;width:100%}
  .top-actions .btn,.top-actions a{width:100%;text-align:center;font-size:11px;padding:8px 5px}
  .grid.grid-2{display:block}
  .grid.grid-2>.card{margin-bottom:14px}
  #personForm.mobile-person-wizard{display:block!important}
  .mobile-person-wizard>.mobile-wizard-step{display:none}
  .mobile-person-wizard>.mobile-wizard-step.active{display:block}
  .mobile-wizard-header{position:sticky;top:0;z-index:20;background:#fff;padding:12px 0 10px;border-bottom:1px solid #ece7dc;margin-bottom:12px}
  .mobile-wizard-header h2{font-size:20px;margin:10px 0 3px}
  .mobile-wizard-header p{font-size:13px;color:#667085;margin:0;line-height:1.5}
  .mobile-wizard-count{font-size:12px;font-weight:800;color:#8b6b27}
  .mobile-wizard-progress{height:7px;background:#eee9df;border-radius:999px;margin-top:7px;overflow:hidden}
  .mobile-wizard-progress span{display:block;height:100%;background:linear-gradient(90deg,#c9942e,#e4bd68);border-radius:999px;transition:width .2s ease}
  .mobile-wizard-step>div{margin-bottom:12px}
  .mobile-wizard-step label{font-size:14px}
  .mobile-wizard-step input,.mobile-wizard-step select,.mobile-wizard-step textarea{font-size:16px;min-height:48px;padding:12px}
  .mobile-wizard-step textarea{min-height:100px}
  .relation-choice{display:grid!important;grid-template-columns:1fr!important}
  .choice-card{min-height:82px;padding:15px}
  .choice-card strong{font-size:16px}
  .origin-status{padding:14px}
  .mobile-wizard-nav{position:fixed;left:0;right:0;bottom:0;z-index:60;background:rgba(255,255,255,.97);border-top:1px solid #ddd5c5;padding:10px 12px calc(10px + env(safe-area-inset-bottom));display:grid;grid-template-columns:1fr 1.6fr;gap:10px;box-shadow:0 -8px 24px rgba(0,0,0,.08)}
  .mobile-wizard-nav .btn{min-height:50px;font-size:16px;font-weight:800}
  .mobile-person-wizard .actions{display:block}
  .mobile-person-wizard .actions button[type="submit"]{display:none}
  .mobile-person-wizard .actions [data-action="cancel-edit"]{width:100%;margin-top:8px}
  .mobile-native-multiselect{position:absolute!important;left:-9999px!important;width:1px!important;height:1px!important;opacity:0!important}
  .mobile-gene-chips{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
  .mobile-gene-chip{display:block!important;margin:0!important}
  .mobile-gene-chip input{position:absolute;opacity:0;width:1px;height:1px;min-height:0}
  .mobile-gene-chip span{display:block;border:1px solid #d7dce2;border-radius:10px;padding:11px 8px;text-align:center;background:#fff;font-size:14px;font-weight:700}
  .mobile-gene-chip:has(input:checked) span{border-color:#c9942e;background:#fff8e9;box-shadow:0 0 0 2px rgba(201,148,46,.12)}
  .list{max-height:none}
}
@media(max-width:380px){
  .mobile-gene-chips{grid-template-columns:1fr}
}
\n\n/* Version 5.4: smooth, stable page navigation */
#app{min-height:100vh;background:#fbfaf7}
#app .main{transition:opacity .14s ease,transform .14s ease}
#app.route-changing .main{opacity:.01;transform:translateY(3px)}
#app.route-ready .main{opacity:1;transform:none}
.btn,.nav button{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.btn:active,.nav button:active,.btn.is-pressed,.nav button.is-pressed{transform:scale(.985);filter:brightness(.97)}
.btn[aria-busy="true"]{pointer-events:none;opacity:.82}
@media(max-width:760px){
  #app .main{transition-duration:.11s}
  #app.route-changing .main{transform:none}
  .mobile-wizard-header{scroll-margin-top:8px}
  .relation-builder{content-visibility:auto;contain-intrinsic-size:180px}
}
@media(prefers-reduced-motion:reduce){
  #app .main,.btn,.nav button,.mobile-wizard-progress span{transition:none!important}
  html{scroll-behavior:auto!important}
}

/* v5.5: Keep the selected origin visible throughout the mobile input wizard. */
@media(max-width:760px){
  .mobile-wizard-header{padding-bottom:12px}
  .mobile-origin-indicator{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;padding:9px 12px;border:1px solid rgba(201,148,46,.5);border-radius:12px;background:#fff8e8;box-shadow:0 3px 10px rgba(80,55,10,.06)}
  .mobile-origin-indicator span{font-size:12px;font-weight:800;color:#7a612d;white-space:nowrap}
  .mobile-origin-indicator strong{font-size:14px;line-height:1.35;color:#2f281b;text-align:right;overflow-wrap:anywhere}
  .mobile-origin-indicator.needs-selection{border-color:#d68b35;background:#fff4e3}
  .mobile-origin-indicator.needs-selection strong{color:#9a4f00}
}


/* v5.6: make the first origin choice actionable and keep wizard controls above mobile navigation. */
@media(max-width:760px){
  body{padding-bottom:174px!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch}
  .content{padding-bottom:112px!important}
  #personForm.mobile-person-wizard{padding-bottom:100px}
  .mobile-wizard-nav{
    bottom:calc(66px + env(safe-area-inset-bottom))!important;
    z-index:110!important;
    padding:10px 12px!important;
    box-shadow:0 -8px 24px rgba(0,0,0,.12)
  }
  .nav{z-index:120!important}
  .origin-self-button{
    width:100%;
    border:1px solid #e2d4b5;
    appearance:none;
    -webkit-appearance:none;
    cursor:pointer;
    text-align:left;
    font-family:inherit;
    min-height:104px;
    touch-action:manipulation;
  }
  .origin-self-button .origin-self-copy{display:block;min-width:0}
  .origin-self-button .origin-self-copy strong{display:block;font-size:17px;margin:0 0 7px;color:#302713}
  .origin-self-button .origin-self-copy small{display:block;font-size:13px;line-height:1.6;color:#776746;font-weight:600}
  .origin-self-button .origin-self-arrow{display:block;flex:0 0 auto;font-size:14px;font-weight:800;color:#9b6e16;white-space:nowrap}
  .origin-self-button:active,.origin-self-button.selected{background:#fff2cf;border-color:#c9942e;box-shadow:0 0 0 3px rgba(201,148,46,.15)}
  .mobile-wizard-step{min-height:220px}
}

/* v5.7: explanatory text for the本人（相談者）ニックネーム field. */
.field-help{
  margin-top:8px;
  color:var(--muted,#6b7280);
  font-size:.88rem;
  line-height:1.55;
}

/* Version 6.0: family-tree validation navigator */
.validation-summary{background:#fff;border:1px solid #e4d5b9;border-radius:18px;padding:18px;margin:0 0 18px;box-shadow:0 8px 22px rgba(65,48,22,.06)}
.validation-summary.compact{padding:14px 16px}
.validation-score{display:flex;justify-content:space-between;gap:12px;align-items:center;font-weight:800}
.validation-score span{color:#765615;font-size:.92rem}
.validation-progress{height:9px;background:#eee9df;border-radius:99px;overflow:hidden;margin:10px 0 12px}
.validation-progress i{display:block;height:100%;background:linear-gradient(90deg,#bd8214,#e4bd59);border-radius:inherit;transition:width .25s ease}
.validation-counts{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.validation-counts span,.validation-badge{display:inline-flex;align-items:center;border-radius:999px;padding:5px 9px;font-weight:800;font-size:.78rem;line-height:1.15}
.validation-counts .error,.validation-badge.error{background:#fde8e7;color:#a5231d}
.validation-counts .warning,.validation-badge.warning{background:#fff1cf;color:#805b08}
.validation-counts .info,.validation-badge.info{background:#eaf0f7;color:#41546c}
.validation-ok{margin:6px 0 0;color:#436445;font-weight:700}
.validation-badge{margin-left:8px;vertical-align:middle}
.person-row.has-error{border-left:5px solid #c43b32;background:#fff8f7}
.person-row.has-warning{border-left:5px solid #d39318;background:#fffdf6}
.person-row.has-info{border-left:5px solid #73879e}
.generation-person.validation-error{outline:4px solid rgba(196,59,50,.42)}
.generation-person.validation-warning{outline:4px solid rgba(211,147,24,.38)}
.generation-person.validation-info{outline:3px solid rgba(115,135,158,.34)}
.generation-person .validation-badge{margin:5px auto;max-width:max-content}
.validation-item{border:1px solid #ddd3c2;border-left-width:6px;border-radius:14px;padding:16px;margin:12px 0;background:#fff}
.validation-item.error{border-left-color:#c43b32;background:#fffafa}
.validation-item.warning{border-left-color:#d39318;background:#fffdf7}
.validation-item.info{border-left-color:#73879e;background:#fbfcfe}
.validation-item-head{display:flex;gap:10px;align-items:flex-start;flex-wrap:wrap}
.validation-item-head span{font-size:.78rem;font-weight:900;border-radius:999px;padding:5px 9px;background:#eee}
.validation-item.error .validation-item-head span{background:#fde8e7;color:#a5231d}
.validation-item.warning .validation-item-head span{background:#fff1cf;color:#805b08}
.validation-item.info .validation-item-head span{background:#eaf0f7;color:#41546c}
.validation-item p{margin:10px 0;color:#4e4a43}
.validation-suggestion{background:rgba(255,255,255,.8);border-radius:10px;padding:10px 12px;margin:10px 0 12px;color:#3f3b35}
.validation-empty{text-align:center;padding:28px;color:#49634c}
@media(max-width:760px){
 .validation-summary{border-radius:14px;padding:14px;margin-bottom:14px}
 .validation-score{align-items:flex-start;flex-direction:column;gap:3px}
 .validation-counts{gap:6px}
 .validation-counts span{font-size:.72rem}
 .validation-item{padding:14px 12px}
 .validation-item .btn{width:100%}
 .validation-badge{font-size:.68rem;padding:4px 7px;margin-left:5px}
}

/* v6.1 詳細不明親類（参考親類） */
.reference-relative-box{border:1px solid #d9c28b;border-radius:14px;padding:12px;background:#fffaf0;transition:.18s ease}
.reference-relative-box.active{border-color:#b88719;background:#fff3cf;box-shadow:0 0 0 3px rgba(184,135,25,.12)}
.reference-check{display:flex;gap:11px;align-items:flex-start;cursor:pointer;margin:0}
.reference-check input{width:22px;height:22px;margin-top:2px;accent-color:#b88719;flex:0 0 auto}
.reference-check span,.reference-check strong,.reference-check small{display:block}
.reference-check strong{font-size:16px;color:#3e3012}
.reference-check small{margin-top:5px;color:#725f37;line-height:1.55;font-weight:500}
.tag.reference{background:#fff0bd;color:#704d00;border:1px solid #d8a93e;font-weight:800}
.reference-tree-label{display:block!important;width:max-content;margin:5px auto 0!important;padding:3px 7px;border-radius:999px;background:#fff0bd;color:#704d00!important;border:1px solid #d8a93e;font-weight:800}
.generation-person:has(.reference-tree-label){border-style:dashed!important}
@media(max-width:760px){.reference-relative-box{padding:11px}.reference-check strong{font-size:15px}.reference-check small{font-size:12px}}

/* v6.2.9: 続柄選択欄をPC・モバイルの両方で常に明確に表示 */
.relationship-select-wrap { display:block; min-width:0; }
.relationship-select-wrap label { display:block; margin-bottom:8px; font-weight:800; }
.relationship-select-wrap select { display:block !important; width:100% !important; min-height:52px; visibility:visible !important; opacity:1 !important; }
@media (max-width:760px){
  .mobile-person-wizard .relationship-select-wrap { display:block; width:100%; }
  .mobile-person-wizard .relationship-select-wrap select { min-height:58px; font-size:18px; padding:12px 42px 12px 14px; }
}

/* v7.0 家系図自動補正AI */
.auto-correction-panel{border:1px solid #dec27b;border-radius:14px;background:linear-gradient(135deg,#fffaf0,#fff);padding:14px;box-shadow:0 8px 20px rgba(91,66,16,.06)}
.auto-correction-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.auto-correction-head span{font-weight:900;color:#7a5100}.auto-correction-head strong{font-size:13px;border-radius:999px;padding:5px 10px;background:#f4ead2;color:#5c4619}
.auto-correction-messages{display:grid;gap:8px;margin-bottom:10px}.auto-correction-message{display:grid;gap:3px;padding:10px 12px;border-radius:10px;background:#f8fafc;border-left:4px solid #64748b}.auto-correction-message strong{font-size:14px}.auto-correction-message span{font-size:12px;line-height:1.6;color:#596579}.auto-correction-message.warning{background:#fff4e5;border-left-color:#d97706}.auto-correction-message.info{background:#eef7ff;border-left-color:#3978a8}.auto-correction-panel[data-level="warning"] .auto-correction-head strong{background:#ffead0;color:#8b4b00}
@media(max-width:760px){.auto-correction-panel{padding:12px}.auto-correction-head{align-items:flex-start;flex-direction:column;gap:6px}.auto-correction-panel .btn{width:100%}.mobile-person-wizard .auto-correction-panel{display:block;width:100%;box-sizing:border-box}}

/* Version 9.0: inheritance pattern switcher */
.inheritance-switch{display:grid;grid-template-columns:minmax(260px,1.6fr) minmax(190px,1fr) minmax(160px,.8fr);gap:10px;align-items:end;flex:1;min-width:min(100%,720px)}
.inheritance-switch label{display:flex;flex-direction:column;gap:5px;font-weight:700;font-size:.88rem;color:#3f392f}
.inheritance-switch select{width:100%;min-height:44px;border:1px solid #d8c9ad;border-radius:12px;background:#fff;padding:8px 34px 8px 10px;font:inherit;color:#25221d}
.inheritance-switch small{grid-column:1/-1;line-height:1.55;color:#6c675f;background:#fbf6ea;border:1px solid #e7d5ad;border-radius:10px;padding:8px 10px}
@media(max-width:900px){.inheritance-switch{grid-template-columns:1fr 1fr}.inheritance-switch label:first-child{grid-column:1/-1}}
@media(max-width:620px){.inheritance-switch{grid-template-columns:1fr}.inheritance-switch label:first-child{grid-column:auto}.inheritance-switch select{font-size:16px}.tree-toolbar{align-items:stretch}.tree-view-switch,.tree-zoom-controls{width:100%;overflow-x:auto}}

/* Version 9.1: conditional non-cancer genetics fields */
.non-cancer-interest-box{padding:16px;border:1px solid #ead9b7;border-radius:18px;background:#fffaf0}
.check-line{display:flex;align-items:center;gap:10px;font-weight:800;cursor:pointer}
.check-line input{width:22px;height:22px;flex:0 0 auto}
.non-cancer-extra{padding:18px;border:1px solid #e4c987;border-radius:18px;background:linear-gradient(180deg,#fffdf8,#fff8e8)}
.non-cancer-tree-note{margin:14px 0}
@media(max-width:760px){.non-cancer-extra{padding:14px}.non-cancer-extra .grid{grid-template-columns:1fr}.inheritance-switch label{min-width:100%}}


/* Version 9.2: automatic inheritance mode resolution */
.mode-status{display:inline-flex;align-items:center;width:max-content;margin-top:2px;padding:3px 8px;border-radius:999px;font-size:11px;font-weight:800;line-height:1.4}
.mode-status.fixed{background:#e8f5ec;color:#24653b;border:1px solid #b8ddc4}
.mode-status.multiple{background:#fff3d8;color:#825800;border:1px solid #ead08f}
.inheritance-switch select:disabled{opacity:1;color:#2f4937;background:#f1f8f3;border-color:#b8ddc4;cursor:not-allowed;-webkit-text-fill-color:#2f4937}

/* Version 9.4: non-cancer genetics consultation placement */
.non-cancer-topic{margin:12px 0;padding:16px;border:1px solid #e2cfaa;border-radius:16px;background:#fff}
.non-cancer-topic-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.non-cancer-topic-head strong{color:#72520f}
#addNonCancerTopic{margin-top:10px}
@media(max-width:760px){.non-cancer-topic{padding:13px}.non-cancer-topic-head{align-items:flex-start}}

/* Version 9.5: editable non-cancer genetics and source notice */
.profile-edit-badge{display:inline-flex;align-items:center;border-radius:999px;padding:4px 9px;margin-bottom:8px;background:#f5ead0;color:#76520d;font-size:11px;font-weight:800}
.profile-submit-actions{display:flex;gap:10px;flex-wrap:wrap}.profile-submit-actions .btn{flex:1;min-width:220px}
.inheritance-source-note{display:block;margin-top:6px;max-width:760px;line-height:1.55;color:#6f6658}
@media(max-width:760px){.profile-submit-actions{display:grid;grid-template-columns:1fr}.profile-submit-actions .btn{min-width:0;width:100%}}
.engine-status-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:14px 0}.engine-status-grid span{padding:10px 12px;border:1px solid #d9e5df;border-radius:10px;background:#f5faf7;font-weight:700}@media(max-width:700px){.engine-status-grid{grid-template-columns:1fr}}

/* Version 10.1: scrollable multi-gene selector */
.gene-native-multiple{position:absolute!important;left:-9999px!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important}
.gene-multi-picker{max-height:270px;overflow-y:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--line,#d7d7d7);border-radius:14px;background:#fff;padding:8px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;overscroll-behavior:contain}
.gene-check-item{display:flex;align-items:center;gap:7px;min-height:42px;padding:8px 10px;border:1px solid #dedede;border-radius:10px;background:#fff;cursor:pointer;user-select:none;font-weight:700}
.gene-check-item:hover{background:#faf7f1}
.gene-check-item:has(input:checked){border-color:#967136;background:#fff7e8;box-shadow:0 0 0 1px rgba(150,113,54,.18)}
.gene-check-item input{width:19px;height:19px;flex:0 0 auto;accent-color:#8b672f}
.gene-check-item span{overflow-wrap:anywhere}
.gene-selection-summary{margin-top:9px;padding:9px 11px;border-radius:10px;background:#f7f7f7;display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap;font-size:.92rem}
.gene-selection-summary strong{white-space:nowrap;color:#704d18}
.gene-selection-summary span{overflow-wrap:anywhere}
@media(max-width:760px){.gene-multi-picker{grid-template-columns:repeat(2,minmax(0,1fr));max-height:300px}.gene-check-item{min-height:46px;padding:10px}.gene-selection-summary{display:block}.gene-selection-summary strong{display:block;margin-bottom:4px}}
@media(max-width:390px){.gene-multi-picker{grid-template-columns:1fr 1fr;gap:6px}.gene-check-item{font-size:.9rem;padding:9px 7px}}

/* Version 11.1 Relative Input Engine */
.relative-input-v111 .relative-engine-status{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border:1px solid #d9c8a5;border-radius:14px;background:#fffaf0}
.relative-input-v111 .relative-engine-status strong{font-size:1.05rem}
.relative-input-v111 .relative-engine-status span{color:#74664d;font-weight:700}
.relative-input-v111 .relative-engine-status.warning{border-color:#d9a441;background:#fff5db}
.relative-input-v111 .relative-engine-status.ok{border-color:#b99a58}
@media(max-width:760px){.relative-input-v111 .relative-engine-status{align-items:flex-start;flex-direction:column}.relative-input-v111{padding-bottom:130px}}

/* Version 11.2: 4親等・説明付き続柄ピッカー */
.relationship-picker-v112 select{min-height:54px;line-height:1.5;background:#fff}
.relationship-picker-v112 select option{padding:8px 10px}
.relationship-picker-v112 select optgroup{font-weight:800;color:#7a5527;background:#f7efe3}
@media(max-width:720px){.relationship-picker-v112 select{min-height:56px;font-size:16px}}

/* Version 14.0: 3親等標準／4親等拡張 */
.fourth-degree-toggle{padding:14px 16px;border:1px solid #d8cfc1;border-radius:12px;background:#fbf8f3}
.fourth-degree-toggle .check-line{font-weight:800;margin:0}
.fourth-degree-toggle .field-help{margin-top:6px}

/* Version 16 Pedigree Engine */
.tree-svg-v16 .tree-person{cursor:pointer}
.tree-svg-v16 .tree-person:hover{filter:drop-shadow(0 4px 7px rgba(15,23,42,.18))}
.tree-svg-v16 .tree-lines path{vector-effect:non-scaling-stroke}
@media(max-width:700px){.tree-svg-v16{min-width:900px}.tree-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}}

/* Version 16.3: searchable extended gene catalog */
.gene-search-box{margin:0 0 12px;padding:12px;border:1px solid #e5d8c8;border-radius:12px;background:#fffaf4}
.gene-search-box label{display:block;font-weight:800;margin-bottom:6px}
.gene-search-box input[type="search"]{width:100%}
.gene-search-extra{display:none}
.gene-search-extra.gene-search-match,.gene-search-extra.selected{display:flex}
.gene-check-item span small{display:block;font-size:10px;font-weight:500;line-height:1.25;color:#6b625b;margin-top:2px}
.gene-specific-notice{display:flex;flex-direction:column;gap:3px;padding:9px 11px;border-left:4px solid #9b6b37;background:#fff8ed;border-radius:8px;font-size:12px}
.gene-specific-notice strong{font-size:13px}
.gene-specific-notice small{line-height:1.45;color:#5f554d}
/* Version 18 report platform */
.report-jump-actions{position:sticky;top:66px;z-index:8;background:rgba(255,255,255,.94);padding:10px;border:1px solid #eadfc9;border-radius:14px;backdrop-filter:blur(8px);margin-bottom:18px}
.v18-report{background:#fff;border:1px solid #e6d7bc;border-radius:18px;padding:24px;margin:0 0 22px;box-shadow:0 10px 28px rgba(80,55,20,.08)}
.v18-report.patient{border-top:6px solid #6b9c7d}.v18-report.clinician{border-top:6px solid #775d91}
.report-hero{padding:4px 4px 18px;border-bottom:1px solid #eee}.report-hero h2{font-size:1.55rem;margin:8px 0}.report-hero p{line-height:1.8;color:#594f43}.report-badge{display:inline-block;background:#f4e7c9;color:#755619;border-radius:999px;padding:4px 10px;font-weight:700;font-size:.82rem}
.v18-report .report-section{padding:18px 4px 4px}.v18-report .report-section h2{font-size:1.15rem;margin:0 0 10px}.v18-report ul{margin:0;padding-left:1.4em}.v18-report li{margin:7px 0;line-height:1.7}
.report-page-break{height:12px}.report-technical-appendix{margin-top:24px}
@media print{.report-jump-actions{display:none!important}.v18-report{box-shadow:none;border-color:#999}.report-page-break{break-before:page;page-break-before:always}.report-technical-appendix{break-before:page;page-break-before:always}}


/* Version 20.1: refined genetic risk map palette */
.generation-person[class*="gene-"]{border-color:var(--gene-stroke,#8c8c8c)!important;background:var(--gene-fill,#f3f1ee)!important;color:var(--gene-text,#55504b)}
.generation-person[class*="gene-"]:after{background:var(--gene-stroke,#8c8c8c)!important}
.generation-person.deceased{background:#171717!important;color:#fff!important}
.gene-legend .positive{color:#7a1f2b;background:#f2e3e5}
.gene-legend .possible{color:#9b3a46;background:#f8edef}
.gene-legend .negative{color:#355c7d;background:#e7eef4}
.gene-legend .blocked{color:#6c8ead;background:#eef3f7}
.gene-legend .other{color:#78658f;background:#f0ecf4}
.gene-legend .untested{color:#77716c;background:#f3f1ee}
.gene-target-positive,.gene-target-possible{background:rgba(255,255,255,.68);color:#642630}
.gene-target-negative{background:#e2ebf2;color:#294a65}.gene-target-blocked{background:#eef3f7;color:#456983}
.gene-target-other{background:#f0ecf4;color:#574666}.gene-target-unknown{background:#f3f1ee;color:#625d58}
.tag.green{background:#e7eef4;color:#294a65;border-color:#a8bdcf}
.gene-negative{color:#355c7d!important}
.risk-map-legend{margin-top:12px;padding:14px;border:1px solid #ded8d4;border-radius:14px;background:#fffdf9;box-shadow:0 4px 14px rgba(50,42,38,.045)}
.risk-map-title{display:flex;justify-content:space-between;gap:12px;align-items:baseline;margin-bottom:10px}.risk-map-title strong{font-size:14px;color:#4f3035}.risk-map-title span{font-size:11px;color:#746d68}
.risk-gradient-row{display:grid;grid-template-columns:repeat(5,1fr);overflow:hidden;border-radius:10px;border:1px solid #cfaeb3}
.risk-stop{min-height:42px;display:flex;align-items:center;justify-content:center;padding:7px 5px;font-size:11px;font-weight:900;text-align:center}
.risk-100{background:#7a1f2b;color:#fff}.risk-75{background:#9b3a46;color:#fff}.risk-50{background:#be6a74;color:#fff}.risk-25{background:#d9a4aa;color:#4f252c}.risk-low{background:#f2e3e5;color:#69434a}
.risk-status-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.risk-status{padding:6px 10px;border-radius:999px;border:2px solid currentColor;font-size:11px;font-weight:850}.risk-status.negative{color:#355c7d;background:#e7eef4}.risk-status.blocked{color:#6c8ead;background:#eef3f7}.risk-status.unknown{color:#77716c;background:#f3f1ee}
.risk-map-legend small{display:block;margin-top:10px;line-height:1.55;color:#746d68}
@media(max-width:640px){.risk-map-title{display:block}.risk-map-title span{display:block;margin-top:4px}.risk-stop{font-size:9px;min-height:48px;padding:5px 2px}}
@media print{.risk-map-legend{break-inside:avoid;box-shadow:none}.risk-gradient-row{-webkit-print-color-adjust:exact;print-color-adjust:exact}.risk-stop,.risk-status,.generation-person{ -webkit-print-color-adjust:exact;print-color-adjust:exact}}


/* Version 20.2: fixed typography and stronger restrained risk fills */
.generation-person[class*="gene-"]{
  color:#272326!important;
  opacity:1!important;
}
.generation-person[class*="gene-"] strong{color:#272326!important;opacity:1!important}
.generation-person[class*="gene-"] span{color:#4d484b!important;opacity:1!important}
.generation-person[class*="gene-"] em{color:#8b681d!important;opacity:1!important}
.generation-person[class*="gene-"] small{opacity:1!important}
.generation-person[class*="gene-"] [class^="gene-target-"]{color:#3e3538!important;background:rgba(255,255,255,.78)!important}
.generation-person.deceased,.generation-person.deceased strong,.generation-person.deceased span,.generation-person.deceased em,.generation-person.deceased small,.generation-person.deceased [class^="gene-target-"]{color:#fff!important}
.risk-100{background:#7a1f2b;color:#fff}
.risk-75{background:#852e3b;color:#fff}
.risk-50{background:#94434f;color:#fff}
.risk-25{background:#a45f69;color:#fff}
.risk-low{background:#ae747d;color:#fff}

/* Version 20.3: white information labels and enlarged person focus */
.generation-person .person-white-label{
  display:block;
  position:relative;
  z-index:2;
  margin:1px;
  padding:10px 8px;
  border:1px solid rgba(82,75,77,.20);
  border-radius:11px;
  background:rgba(255,255,255,.95);
  box-shadow:0 2px 7px rgba(39,31,33,.06);
  color:#211f20!important;
}
.generation-person .person-white-label strong,
.generation-person .person-white-label span,
.generation-person .person-white-label em,
.generation-person .person-white-label small{color:#211f20!important;opacity:1!important}
.generation-person .person-white-label [class^="gene-target-"],
.generation-person .person-white-label .risk-mini{background:#f7f5f3!important;color:#211f20!important;border:1px solid #e5e0dc}
.generation-person.deceased .person-white-label,
.generation-person.deceased .person-white-label strong,
.generation-person.deceased .person-white-label span,
.generation-person.deceased .person-white-label em,
.generation-person.deceased .person-white-label small{color:#211f20!important}
.tree-svg-v16 .tree-person-white-label{pointer-events:none}

.tree-person-focus-backdrop{
  position:fixed;inset:0;z-index:1000;
  display:flex;align-items:center;justify-content:center;
  padding:20px;background:rgba(24,20,22,.58);
  backdrop-filter:blur(5px);
}
.tree-person-focus-modal{
  position:relative;width:min(620px,94vw);max-height:88vh;overflow:auto;
  border:3px solid var(--focus-color,#7a1f2b);border-radius:24px;
  background:var(--focus-fill,#ae747d);
  box-shadow:0 24px 70px rgba(0,0,0,.30);
  padding:24px;
  animation:treeFocusIn .18s ease-out;
}
@keyframes treeFocusIn{from{opacity:0;transform:scale(.94) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}
.tree-person-focus-close{
  position:absolute;right:12px;top:12px;z-index:2;width:40px;height:40px;
  border:0;border-radius:50%;background:#fff;color:#211f20;font-size:28px;line-height:1;
  box-shadow:0 3px 12px rgba(0,0,0,.15);cursor:pointer;
}
.tree-person-focus-symbol{
  width:116px;height:86px;margin:4px auto -24px;position:relative;z-index:1;
  display:flex;align-items:flex-start;justify-content:center;
  border:4px solid;border-radius:15px;padding-top:8px;
}
.tree-person-focus-symbol.female{border-radius:50%}
.tree-person-focus-symbol span{padding:4px 10px;border-radius:999px;background:var(--focus-color,#7a1f2b);color:#fff;font-size:12px;font-weight:900}
.tree-person-focus-white{
  position:relative;background:#fff;border-radius:18px;padding:38px 28px 26px;
  color:#211f20;text-align:center;box-shadow:0 6px 20px rgba(33,26,28,.10);
}
.tree-person-focus-relation{display:inline-block;margin:0 0 5px;padding:4px 10px;border-radius:999px;background:#f1eeeb;color:#5c5558;font-size:12px;font-weight:800}
.tree-person-focus-white h2{margin:4px 0 5px;font-size:28px;color:#211f20}
.tree-person-focus-basic{margin:0 0 18px;color:#514b4e;font-weight:700}
.tree-person-focus-white dl{margin:0;text-align:left;border-top:1px solid #e8e3df}
.tree-person-focus-white dl>div{display:grid;grid-template-columns:145px 1fr;gap:12px;padding:13px 4px;border-bottom:1px solid #eeeae7}
.tree-person-focus-white dt{font-size:12px;font-weight:900;color:#6a6064}
.tree-person-focus-white dd{margin:0;color:#211f20;font-weight:700;line-height:1.55;overflow-wrap:anywhere}
.tree-person-focus-white dd small{display:block;margin-top:3px;color:#625b5e;font-weight:500}
.tree-person-focus-white .actions{justify-content:center;margin-top:20px}
@media(max-width:560px){
  .tree-person-focus-backdrop{padding:10px;align-items:flex-end}
  .tree-person-focus-modal{width:100%;max-height:92vh;border-radius:22px 22px 10px 10px;padding:18px 12px 12px}
  .tree-person-focus-white{padding:36px 16px 20px}
  .tree-person-focus-white h2{font-size:23px}
  .tree-person-focus-white dl>div{display:block}
  .tree-person-focus-white dt{margin-bottom:5px}
}
@media print{.tree-person-focus-backdrop{display:none!important}.tree-person-white-label{fill:#fff!important;fill-opacity:1!important}}

/* Version 21.0: SHINRA Clinical Card UI */
:root{
  --v21-text:#2f3742;
  --v21-sub:#66707d;
  --v21-line:#dfe3e8;
  --v21-surface:#ffffff;
}
.generation-person[class*="gene-"]{
  position:relative;overflow:hidden;
  background:#fff!important;
  border:1px solid #dde2e7!important;
  border-radius:16px!important;
  box-shadow:0 8px 24px rgba(37,43,52,.08)!important;
  color:var(--v21-text)!important;
  padding:0!important;
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.generation-person[class*="gene-"]:hover,
.generation-person[class*="gene-"]:focus-visible{
  transform:translateY(-2px);
  border-color:var(--gene-stroke)!important;
  box-shadow:0 12px 30px rgba(37,43,52,.14)!important;
}
.generation-person[class*="gene-"]:after{display:none!important}
.generation-person .person-accent{display:block;height:7px;background:var(--gene-stroke);width:100%}
.generation-person .person-white-label{
  margin:0!important;padding:13px 14px 14px!important;border:0!important;border-radius:0!important;
  background:#fff!important;box-shadow:none!important;color:var(--v21-text)!important;text-align:left;
}
.person-head{display:flex!important;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:5px}
.person-head strong{font-size:14px!important;letter-spacing:.01em;color:var(--v21-text)!important}
.person-head b{font-size:11px;color:var(--v21-sub)!important;white-space:nowrap}
.generation-person .person-white-label>span:not(.person-head):not(.risk-meter){font-size:10.5px;color:var(--v21-sub)!important}
.generation-person .person-white-label em{display:block;margin-top:7px;font-size:10px;font-style:normal;color:#795b24!important}
.generation-person .person-white-label [class^="gene-target-"]{
  display:block;margin-top:8px;padding:0!important;border:0!important;background:transparent!important;
  color:var(--v21-text)!important;font-size:11px;font-weight:800;line-height:1.35;
}
.risk-meter{display:grid!important;grid-template-columns:1fr auto;align-items:center;gap:8px;margin-top:10px;height:auto!important;color:var(--gene-stroke)!important}
.risk-meter:before{content:"";grid-column:1;grid-row:1;height:6px;border-radius:999px;background:#edf0f3}
.risk-meter i{grid-column:1;grid-row:1;display:block;width:var(--risk-level);height:6px;border-radius:999px;background:var(--gene-stroke)}
.risk-meter b{grid-column:2;grid-row:1;font-size:10px;color:var(--gene-stroke)!important}
.generation-person .risk-mini{margin-top:8px!important;background:#f7f8fa!important;border:1px solid #e5e8ec!important;color:#56606d!important}
.generation-person.deceased{background:#fff!important;color:var(--v21-text)!important}

.risk-100{background:#8b0e2d;color:#fff}.risk-75{background:#aa1f43;color:#fff}.risk-50{background:#c93655;color:#fff}.risk-25{background:#d9536d;color:#fff}.risk-low{background:#e78396;color:#fff}
.gene-legend .positive{color:#8b0e2d;background:#fbecef}.gene-legend .possible{color:#c93655;background:#fbecef}

.tree-svg-v200{background:#f8f9fa}
.tree-person-v21{cursor:pointer;filter:drop-shadow(0 5px 7px rgba(38,45,55,.08));transition:filter .15s ease}
.tree-person-v21:hover,.tree-person-v21:focus{filter:drop-shadow(0 8px 12px rgba(38,45,55,.16));outline:none}
.tree-person-v21 text{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif}

.tree-person-focus-backdrop{background:rgba(30,36,45,.46);backdrop-filter:blur(8px)}
.tree-person-focus-modal{
  padding:0!important;border:1px solid rgba(255,255,255,.5)!important;border-radius:26px!important;
  background:#fff!important;overflow:hidden!important;box-shadow:0 28px 80px rgba(23,28,36,.30)!important;
}
.focus-accent{display:block;height:9px;background:var(--focus-color)}
.tree-person-focus-close{top:18px;right:18px;background:#f1f3f5;color:#39424e;box-shadow:none}
.tree-person-focus-symbol{
  width:90px;height:66px;margin:24px auto -18px;background:#fff!important;
  border:3px solid var(--focus-color)!important;border-radius:16px;padding-top:8px;
}
.tree-person-focus-symbol.female{border-radius:50%}
.tree-person-focus-symbol span{background:var(--focus-color);color:#fff}
.tree-person-focus-white{box-shadow:none!important;border-radius:0!important;padding:34px 34px 30px!important}
.tree-person-focus-white h2{color:var(--v21-text);font-size:30px;letter-spacing:.01em}
.tree-person-focus-basic{color:var(--v21-sub)}
.focus-risk-meter{display:flex;align-items:center;gap:12px;margin:4px auto 22px;max-width:360px}
.focus-risk-meter>span{flex:1;height:8px;border-radius:999px;background:#edf0f3;overflow:hidden}
.focus-risk-meter i{display:block;width:var(--risk-level);height:100%;border-radius:999px;background:var(--focus-color)}
.focus-risk-meter strong{min-width:42px;text-align:right;color:var(--focus-color);font-size:14px}
.tree-person-focus-white dl{border-top-color:#e5e8ec}
.tree-person-focus-white dl>div{border-bottom-color:#edf0f3}
.tree-person-focus-white dt{color:#707a87}
.tree-person-focus-white dd{color:var(--v21-text)}
@media(max-width:560px){
  .tree-person-focus-modal{border-radius:24px 24px 8px 8px!important}
  .tree-person-focus-white{padding:34px 18px 22px!important}
}
@media print{
  .generation-person[class*="gene-"]{box-shadow:none!important}
  .person-accent,.risk-meter i,.focus-accent{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* Version 21.1: Icon Clinical Card refinement */
.tree-person-v211{filter:drop-shadow(0 7px 10px rgba(37,44,54,.10))}
.tree-person-v211:hover,.tree-person-v211:focus{filter:drop-shadow(0 12px 18px rgba(37,44,54,.18))}
.tree-person-v211 .tree-person-white-label{fill:#fff!important;stroke:#e5e8ec!important}
.tree-person-v211 text{paint-order:stroke;stroke:transparent;stroke-width:0}
@media print{.tree-person-v211{filter:none!important}}


/* Version 21.2: gender silhouette cards
   Male = crisp square, Female = generously rounded rectangle. */
.generation-person.sex-male[class*="gene-"]{border-radius:6px!important}
.generation-person.sex-female[class*="gene-"]{border-radius:28px!important}
.generation-person.sex-unknown[class*="gene-"]{border-radius:16px!important}
.generation-person.sex-male .person-white-label{border-radius:0 0 5px 5px!important}
.generation-person.sex-female .person-white-label{border-radius:0 0 27px 27px!important;padding-left:16px!important;padding-right:16px!important}
.generation-person.sex-unknown .person-white-label{border-radius:0 0 15px 15px!important}

.tree-person-v211.sex-male .tree-person-white-label{rx:3px}
.tree-person-v211.sex-female .tree-person-white-label{rx:24px}

/* Enlarged detail symbol follows the same visual language. */
.tree-person-focus-symbol.male{border-radius:6px!important}
.tree-person-focus-symbol.female{border-radius:28px!important}

@media(max-width:560px){
  .generation-person.sex-female[class*="gene-"]{border-radius:24px!important}
  .generation-person.sex-female .person-white-label{border-radius:0 0 23px 23px!important}
}

/* Version 21.4: refined modal header band and balanced footer/bar layout */
.tree-person-focus-status-band{
  padding:18px 22px 10px;
  background:#fff;
}
.focus-status-chip{
  width:100%;
  min-height:64px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  border-radius:999px;
  background:linear-gradient(135deg,var(--focus-color),#e23a3a);
  color:#fff;
  border:4px solid #fff;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.78), 0 8px 20px rgba(139,14,45,.16);
  font-weight:900;
  font-size:17px;
  letter-spacing:.02em;
}
.focus-status-chip::before{
  content:'🧬';
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;height:42px;
  border-radius:50%;
  background:rgba(255,255,255,.96);
  color:var(--focus-color);
  font-size:22px;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
}
.focus-status-chip b{font-size:inherit;line-height:1.1}
.tree-person-focus-white{
  padding-top:18px!important;
}
.tree-person-focus-white .focus-actions{
  justify-content:center;
  align-items:center;
  gap:14px;
  margin-top:24px;
  padding-top:14px;
  border-top:1px solid #edf0f3;
}
.tree-person-focus-white .focus-actions .btn{
  min-width:164px;
  min-height:48px;
  border-radius:999px;
  font-weight:800;
}
.tree-person-focus-white .focus-actions .btn.primary{
  background:linear-gradient(135deg,#c89532,#b97b11);
}
@media(max-width:560px){
  .tree-person-focus-status-band{padding:14px 14px 8px}
  .focus-status-chip{min-height:58px;font-size:15px;gap:10px}
  .focus-status-chip::before{width:38px;height:38px;font-size:20px}
  .tree-person-focus-white .focus-actions{gap:10px;padding-top:12px}
  .tree-person-focus-white .focus-actions .btn{min-width:0;flex:1}
}


/* Version 21.5: popup layout rebalance and always-visible action buttons */
.tree-person-focus-backdrop{
  align-items:center;
  justify-content:center;
  padding:18px;
  overflow:auto;
}
.tree-person-focus-modal{
  width:min(620px,94vw);
  max-height:calc(100vh - 36px)!important;
  display:flex;
  flex-direction:column;
  overflow:hidden!important;
}
.tree-person-focus-status-band{
  flex:0 0 auto;
}
.tree-person-focus-white{
  flex:1 1 auto;
  overflow-y:auto;
  overflow-x:hidden;
  padding:18px 34px 22px!important;
  min-height:0;
}
.tree-person-focus-white h2{
  margin-top:2px;
  margin-bottom:4px;
}
.tree-person-focus-basic{
  margin:0 0 14px;
}
.focus-risk-meter{
  margin:4px auto 16px;
}
.tree-person-focus-white dl{
  margin-bottom:0;
}
.tree-person-focus-white dl>div{
  padding:11px 4px;
}
.tree-person-focus-white .focus-actions{
  position:sticky;
  bottom:0;
  z-index:2;
  background:linear-gradient(to top,#ffffff 78%,rgba(255,255,255,.95) 100%);
  margin-top:16px;
  padding-top:14px;
  padding-bottom:2px;
}
.tree-person-focus-white .focus-actions .btn{
  min-width:170px;
  min-height:46px;
}
@media(max-height:760px){
  .tree-person-focus-backdrop{align-items:flex-start;padding-top:14px;padding-bottom:14px}
  .tree-person-focus-modal{max-height:calc(100vh - 28px)!important}
  .tree-person-focus-status-band{padding:14px 18px 8px}
  .focus-status-chip{min-height:58px;font-size:15px}
  .tree-person-focus-white{padding:14px 26px 18px!important}
  .tree-person-focus-white h2{font-size:28px}
  .tree-person-focus-white dl>div{grid-template-columns:132px 1fr;gap:10px;padding:10px 4px}
}
@media(max-width:560px){
  .tree-person-focus-backdrop{padding:8px;align-items:flex-end}
  .tree-person-focus-modal{width:100%;max-height:calc(100vh - 16px)!important;border-radius:24px 24px 10px 10px!important}
  .tree-person-focus-white{padding:14px 16px 18px!important}
  .tree-person-focus-white .focus-actions{gap:10px;padding-top:12px;padding-bottom:0}
  .tree-person-focus-white .focus-actions .btn{min-width:0;flex:1;min-height:44px}
}

/* Version 21.6: inline segmented risk indicator, cleaner card interior, popup detail icons */
.tree-person-focus-white dt{
  display:flex;
  align-items:center;
  gap:8px;
}
.focus-detail-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px;
  min-width:22px;
  height:22px;
  font-size:16px;
  line-height:1;
}

/* Version 24.7: person detail popup -> add a relative from the selected person */
.tree-person-add-relative{
  position:absolute;
  top:16px;
  right:62px;
  z-index:8;
  max-width:280px;
  min-height:38px;
  padding:8px 13px;
  border:1px solid rgba(255,255,255,.68);
  border-radius:999px;
  background:rgba(255,255,255,.94);
  color:#35404d;
  font-size:12px;
  font-weight:850;
  line-height:1.25;
  box-shadow:0 5px 16px rgba(25,34,45,.12);
  cursor:pointer;
}
.tree-person-add-relative:hover{background:#fff;transform:translateY(-1px)}
.tree-relative-add-menu{
  margin:12px 0 18px;
  padding:16px;
  border:1px solid #dde3e9;
  border-radius:16px;
  background:#f7f9fb;
  text-align:left;
}
.tree-relative-add-menu p{margin:0 0 12px;color:#35404d;line-height:1.55}
.tree-relative-add-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
.tree-relative-add-grid button{
  min-height:42px;
  padding:8px 6px;
  border:1px solid #cfd7df;
  border-radius:11px;
  background:#fff;
  color:#34404d;
  font-weight:850;
  cursor:pointer;
}
.tree-relative-add-grid button:hover{border-color:var(--focus-color,#6b7280);box-shadow:0 0 0 2px color-mix(in srgb,var(--focus-color,#6b7280) 15%,transparent)}
.tree-relative-add-cancel{margin-top:10px;padding:6px 0;border:0;background:transparent;color:#687382;font-weight:750;cursor:pointer}
@media(max-width:760px){
  .tree-person-add-relative{top:14px;right:54px;max-width:205px;padding:7px 10px;font-size:10.5px}
  .tree-relative-add-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tree-relative-add-grid button:nth-child(3){grid-column:1/-1}
}

/* Version 25.2: 色覚差に配慮した関係線・遺伝経路強調 */
.tree-svg-v200 .pedigree-line{transition:opacity .18s ease,filter .18s ease,stroke-width .18s ease}
.tree-svg-v200 .pedigree-line.relation-parent{stroke-linecap:round}
.tree-svg-v200 .pedigree-line.relation-sibling{stroke-linecap:butt}
.tree-svg-v200 .pedigree-line.relation-spouse{stroke-linecap:round}
.tree-svg-v200.has-tree-selection .pedigree-line.is-route-muted,
.tree-svg-v200.has-tree-selection .pedigree-joint.is-route-muted,
.tree-svg-v200.has-tree-selection .pedigree-overpass-halo.is-route-muted{opacity:.10}
.tree-svg-v200.has-tree-selection .pedigree-line.is-route-active{opacity:1;filter:drop-shadow(0 0 3px rgba(29,78,216,.45))}
.tree-svg-v200.has-tree-selection .pedigree-line.is-route-active.has-genetic-flow{animation:pedigreeRoutePulse 1.25s ease-in-out infinite}
.tree-svg-v200.has-tree-selection .tree-person.tree-muted{opacity:.22;filter:grayscale(.6)}
.tree-svg-v200.has-tree-selection .tree-person.tree-related{opacity:1}
.tree-svg-v200.has-tree-selection .tree-person.tree-selected{filter:drop-shadow(0 0 10px rgba(29,78,216,.72))}
.tree-svg-v200.has-tree-selection .tree-person.tree-selected>rect:first-child{stroke-width:6!important}
@keyframes pedigreeRoutePulse{0%,100%{filter:drop-shadow(0 0 2px rgba(29,78,216,.34))}50%{filter:drop-shadow(0 0 7px rgba(29,78,216,.78))}}
@media (prefers-reduced-motion:reduce){.tree-svg-v200 .pedigree-line{transition:none}.tree-svg-v200.has-tree-selection .pedigree-line.is-route-active.has-genetic-flow{animation:none}}
@media print{.tree-svg-v200 .pedigree-line,.tree-svg-v200 .tree-person{animation:none!important;opacity:1!important;filter:none!important}}


/* Version 25.3: custom confirmation dialog without browser domain header */
.app-dialog-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.42);display:flex;align-items:center;justify-content:center;padding:20px;z-index:10000}
.app-dialog{width:min(92vw,640px);max-height:min(86vh,760px);overflow:auto;background:#fff;border-radius:22px;box-shadow:0 30px 80px rgba(15,23,42,.24);border:1px solid rgba(148,163,184,.28)}
.app-dialog-head{padding:20px 22px 10px;border-bottom:1px solid #e5e7eb}
.app-dialog-head h2{margin:0;font-size:1.2rem;line-height:1.4;color:#111827}
.app-dialog-status{display:inline-flex;align-items:center;width:max-content;margin:0 0 8px;padding:4px 10px;border-radius:999px;font-size:.78rem;font-weight:900;letter-spacing:.04em;background:#eef2f7;color:#334155}
.dialog-new .app-dialog-head{background:#f0fdf4;border-bottom-color:#bbf7d0}
.dialog-new .app-dialog-status{background:#dcfce7;color:#166534}
.dialog-edit .app-dialog-head{background:#eff6ff;border-bottom-color:#bfdbfe}
.dialog-edit .app-dialog-status{background:#dbeafe;color:#1d4ed8}
.dialog-delete .app-dialog-head{background:#fef2f2;border-bottom-color:#fecaca}
.dialog-delete .app-dialog-status{background:#fee2e2;color:#b91c1c}

.app-dialog-body{padding:18px 22px;color:#374151}
.app-dialog-lead{margin:0 0 14px;color:#475569}
.app-dialog-actions{display:flex;justify-content:flex-end;gap:10px;padding:14px 22px 22px;border-top:1px solid #f1f5f9;position:sticky;bottom:0;background:#fff}
.relationship-confirm-list{display:grid;gap:10px;margin:0}
.relationship-confirm-list div{display:grid;grid-template-columns:140px 1fr;gap:8px;padding:10px 12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px}
.relationship-confirm-list dt{font-weight:700;color:#334155}
.relationship-confirm-list dd{margin:0;color:#111827;line-height:1.55}
.relationship-confirm-warnings{margin-top:16px;padding:14px;border:1px solid #fed7aa;background:#fff7ed;border-radius:14px}
.relationship-confirm-warnings h3{margin:0 0 10px;color:#9a3412;font-size:1rem}
.relationship-confirm-warnings .warning-item{padding:8px 10px;border-radius:10px;background:#fff}
.relationship-confirm-warnings .warning-item + .warning-item{margin-top:8px}
.relationship-confirm-warnings .warning-item strong{display:block;color:#9a3412;margin-bottom:2px}
.relationship-confirm-warnings .warning-item small{display:block;color:#7c2d12;line-height:1.45}
@media (max-width: 700px){
  .app-dialog-backdrop{padding:14px}
  .app-dialog{width:100%;max-height:calc(100vh - 28px);border-radius:22px}
  .app-dialog-head,.app-dialog-body,.app-dialog-actions{padding-left:16px;padding-right:16px}
  .relationship-confirm-list div{grid-template-columns:1fr;gap:4px}
}

/* Version 25.3: finer patterned dotted lines */
.tree-svg-v200 .pedigree-dot-pattern{pointer-events:none;transition:opacity .18s ease,filter .18s ease,transform .18s ease;paint-order:stroke fill;vector-effect:non-scaling-stroke}
.tree-svg-v200.has-tree-selection .pedigree-dot-pattern.is-route-muted{opacity:.10}
.tree-svg-v200.has-tree-selection .pedigree-dot-pattern.is-route-active{opacity:1;filter:drop-shadow(0 0 2px rgba(29,78,216,.38))}
.tree-svg-v200.has-tree-selection .pedigree-dot-pattern.is-route-active.has-genetic-flow{animation:pedigreeRoutePulse 1.25s ease-in-out infinite}
@media (prefers-reduced-motion:reduce){.tree-svg-v200 .pedigree-dot-pattern{transition:none}.tree-svg-v200.has-tree-selection .pedigree-dot-pattern.is-route-active.has-genetic-flow{animation:none}}
@media print{.tree-svg-v200 .pedigree-dot-pattern{animation:none!important;opacity:1!important;filter:none!important}}

/* Version 25.9: smartphone full-width layout and isolated pedigree scrolling */
html,body{max-width:100%;overflow-x:hidden}
#app,.shell,.main,.topbar,.content{box-sizing:border-box;max-width:100%}
.main{width:100%;overflow-x:clip}
.content{width:100%}
.tree-wrap{width:100%;max-width:100%;box-sizing:border-box;contain:layout paint}
.tree-wrap.detail-view{overflow-x:auto;overflow-y:auto;overscroll-behavior-x:contain}
.tree-wrap.detail-view .tree-canvas{max-width:none}
.tree-wrap.fit-view .tree-canvas{width:100%;max-width:100%}
.tree-wrap.fit-view .tree-svg{display:block;width:100%;max-width:100%;min-width:0;height:auto}

@media(max-width:760px){
  html,body,#app,.shell,.main,.sidebar,.topbar,.content{width:100%;max-width:100%;min-width:0}
  body{margin:0;overflow-x:hidden}
  .shell{overflow-x:hidden}
  .sidebar,.topbar,.content{box-sizing:border-box}
  .sidebar{margin:0}
  .topbar{left:0;right:0}
  .content{margin:0;padding-left:12px;padding-right:12px}
  .content>.card,.content>.grid,.content>.notice,.content>.lead,.content>.page-title{max-width:100%;box-sizing:border-box}
  .tree-wrap{margin-left:0!important;margin-right:0!important}
  .tree-wrap.detail-view{width:100%;max-width:100%;overflow-x:auto;overflow-y:auto;-webkit-overflow-scrolling:touch}
  .tree-wrap.detail-view .tree-canvas{display:inline-block;width:max-content;min-width:max-content;max-width:none}
  .tree-wrap.detail-view .tree-svg{display:block;max-width:none}
  .tree-wrap.fit-view{overflow:hidden}
  .tree-wrap.fit-view .tree-canvas{display:block;width:100%;min-width:0;max-width:100%;transform:none!important}
  .tree-wrap.fit-view .tree-svg,.tree-wrap.fit-view .tree-svg-v16{width:100%;min-width:0!important;max-width:100%;height:auto}
  .mobile-generation-tree{width:100%;max-width:100%;box-sizing:border-box}
}

/* Version 26.1: backup and restore controls */
.data-management-card{border:2px solid #dbc18b;background:#fffdf8}
.data-management-card h2{margin-bottom:8px}
.backup-large{min-height:52px;padding:14px 18px;font-size:15px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.restore-file-label{box-sizing:border-box}
.btn.danger{background:#fff;border-color:#b85b55;color:#8d2f2a}
.btn.danger:hover{background:#fff4f3}
@media(max-width:640px){.data-management-card{padding:18px 14px}.backup-actions{display:grid;grid-template-columns:1fr}.backup-large{width:100%;min-height:58px;font-size:16px}.backup-status{line-height:1.7}}


/* Version 26.2: compact single-line page header; utility actions only on Settings. */
.page-location{display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.25}
.topbar:not(.has-actions){min-height:46px;justify-content:flex-start}
@media(max-width:760px){
  .topbar{align-items:center}
  .topbar:not(.has-actions){padding:8px 12px;min-height:38px}
  .page-location{font-size:clamp(9px,3.2vw,13px)!important;letter-spacing:0!important;max-width:100%}
  .topbar.has-actions{align-items:flex-start;flex-wrap:wrap}
  .topbar.has-actions .page-location{width:100%}
}
@media(max-width:360px){.page-location{font-size:9px!important}}


/* Version 26.3: popup summary panel with left-aligned relation/history and right-side relative action */
.tree-person-summary-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) 124px;
  gap:18px;
  align-items:start;
  text-align:left;
}
.tree-person-summary-main{
  min-width:0;
  text-align:left;
}
.tree-person-summary-main .tree-person-focus-relation{
  display:inline-block;
  margin:0 0 6px;
}
.tree-person-summary-main h2{
  margin:0 0 6px;
  text-align:left;
  font-weight:900;
}
.tree-person-summary-main .tree-person-focus-basic{
  margin:0 0 12px;
  text-align:left;
}
.tree-person-brief-lines{
  display:grid;
  gap:6px;
}
.tree-person-cancer-brief,
.tree-person-gene-brief{
  margin:0;
  text-align:left;
}
.tree-person-cancer-brief strong{
  display:block;
  margin-bottom:2px;
  color:#374151;
  font-size:12px;
  font-weight:900;
}
.tree-person-cancer-brief span{
  display:block;
  color:#111827;
  font-size:14px;
  font-weight:800;
  line-height:1.5;
}
.tree-person-gene-brief{
  display:grid;
  gap:2px;
}
.tree-person-gene-brief span{
  display:block;
  color:#667085;
  font-size:12px;
  line-height:1.45;
  font-weight:700;
}
.tree-person-summary-side{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  justify-self:end;
}
.tree-person-add-relative-circle{
  position:static;
  top:auto;
  right:auto;
  z-index:auto;
  width:104px;
  height:104px;
  max-width:none;
  min-height:104px;
  padding:10px;
  border:1px solid #bfdfc8;
  border-radius:50%;
  background:linear-gradient(180deg,#eef9f0 0%,#ddf2e1 100%);
  color:#255b36;
  box-shadow:0 10px 24px rgba(37,91,54,.14);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  text-align:center;
}
.tree-person-add-relative-circle:hover{
  background:linear-gradient(180deg,#f6fdf7 0%,#e6f7ea 100%);
}
.tree-person-add-relative-plus{
  display:block;
  font-size:30px;
  line-height:1;
  font-weight:900;
}
.tree-person-add-relative-text{
  display:block;
  font-size:12px;
  line-height:1.25;
  font-weight:900;
}
.tree-person-add-relative-caption{
  margin:0;
  color:#5e6a64;
  font-size:11px;
  line-height:1.45;
  font-weight:700;
  text-align:center;
}
.tree-person-focus-white .focus-risk-meter{
  margin:12px 0 16px;
  max-width:none;
}
@media(max-width:560px){
  .tree-person-summary-grid{
    grid-template-columns:minmax(0,1fr) 92px;
    gap:12px;
  }
  .tree-person-add-relative-circle{
    width:84px;
    height:84px;
    min-height:84px;
    padding:8px;
  }
  .tree-person-add-relative-plus{font-size:24px}
  .tree-person-add-relative-text{font-size:10.5px}
  .tree-person-add-relative-caption{font-size:10px}
}
@media(max-width:420px){
  .tree-person-summary-grid{
    grid-template-columns:1fr;
  }
  .tree-person-summary-side{
    width:100%;
    flex-direction:row;
    justify-content:flex-end;
    align-items:center;
    gap:10px;
  }
  .tree-person-add-relative-caption{
    max-width:140px;
    text-align:left;
  }
}

/* Version 26.3: password-protected administrator file-management screen */
.admin-entry-card{border-left:5px solid #7a8f80}
.admin-login-card{max-width:680px;margin:0 auto}
.admin-login-error{min-height:24px;color:#b42318;font-weight:800}
.admin-head-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.admin-upload-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0}
.admin-file-list{display:grid;gap:10px;margin:14px 0 18px}
.admin-file-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:13px 14px;border:1px solid #e1e6e3;border-radius:14px;background:#fff}
.admin-file-row>div:first-child{min-width:0;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.admin-file-row strong{overflow-wrap:anywhere;color:#25302a}
.admin-file-row small{display:block;width:100%;color:#6b756f}
.admin-file-row.is-disabled{background:#f7f7f7;opacity:.72}
@media(max-width:620px){
  .admin-head-row,.admin-file-row{align-items:stretch;flex-direction:column}
  .admin-file-row .row-actions{justify-content:flex-end}
}


/* Version 26.3: approved medical knowledge overlay workflow */
.admin-state-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:14px}
.admin-state-grid>div{padding:14px;border:1px solid #dfe7e1;border-radius:14px;background:#f8fbf9}
.admin-state-grid small{display:block;color:#68736c;margin-bottom:5px}
.admin-state-grid strong{display:block;color:#24372a;overflow-wrap:anywhere}
.admin-candidate-card{border:1px solid #e0e6e2;border-radius:16px;overflow:hidden;background:#fff}
.admin-candidate-card+.admin-candidate-card{margin-top:12px}
.admin-candidate-detail{padding:16px;border-top:1px solid #e7ece8;background:#fbfdfb}
.admin-validation-summary{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:12px 14px;border-radius:12px;margin-bottom:12px}
.admin-validation-summary.ok{background:#edf8f0;color:#285d37}
.admin-validation-summary.error{background:#fff0ef;color:#9d2f27}
.admin-diff-list{display:grid;gap:8px;margin:14px 0}
.admin-diff-row{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:start;padding:12px;border:1px solid #dfe6e1;border-radius:12px;background:#fff;cursor:pointer}
.admin-diff-row input{margin-top:4px}
.admin-diff-row span{min-width:0}
.admin-diff-row strong,.admin-diff-row small,.admin-diff-row em{display:block}
.admin-diff-row small{color:#66726b;margin-top:2px}
.admin-diff-row em{font-style:normal;color:#4f5c54;font-size:12px;line-height:1.5;margin-top:4px}
.admin-history-list{display:grid;gap:9px;margin-top:12px}
.admin-history-row{padding:12px 14px;border:1px solid #e1e7e3;border-radius:12px;background:#fff}
.admin-history-row strong,.admin-history-row small,.admin-history-row em{display:block}
.admin-history-row span{display:block;color:#425148;margin-top:3px}
.admin-history-row small{color:#6c756f;margin-top:4px}
.admin-history-row em{font-style:normal;color:#a33b32;margin-top:4px}
@media(max-width:700px){.admin-state-grid{grid-template-columns:1fr}.admin-validation-summary{align-items:flex-start;flex-direction:column}}

/* Version 27.0: AI medical update candidate review */
.admin-search-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:16px 0}.admin-search-grid label{display:block;font-weight:800;margin-bottom:6px}.admin-search-grid input{width:100%}.admin-source-grid{display:flex;flex-wrap:wrap;gap:8px}.admin-source-check{display:inline-flex!important;align-items:center;gap:7px;padding:9px 12px;border:1px solid #dce5df;border-radius:999px;background:#fff;font-weight:700!important;margin:0!important}.admin-source-check input{width:auto}.admin-search-status{min-height:0;margin-top:12px;padding:0}.admin-search-status.busy,.admin-search-status.error,.admin-search-status.ok{padding:12px 14px;border-radius:12px}.admin-search-status.busy{background:#eef4ff;color:#274d85}.admin-search-status.error{background:#fff0ef;color:#9d2f27}.admin-search-status.ok{background:#edf8f0;color:#285d37}.candidate-rank{min-width:132px}.candidate-rank strong{color:#916300;letter-spacing:1px}.candidate-rank small{display:block;margin-top:4px}.candidate-title-line{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.candidate-ai-summary{padding:10px 12px;background:#f1f7f3;border-left:4px solid #6d9278;border-radius:8px}.candidate-reference-list{display:grid;gap:6px;margin:10px 0}.candidate-reference-list>div{padding:8px 10px;background:#f7f8f7;border-radius:8px}.candidate-reference-list small{display:block;color:#66726b}.candidate-json-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}.candidate-json-grid>div{min-width:0}.candidate-json-grid code{display:block;white-space:pre-wrap;overflow-wrap:anywhere;max-height:260px;overflow:auto;padding:10px;border:1px solid #e1e6e3;border-radius:8px;background:#fff;font-size:11px}.candidate-decision-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.decision-approve{border-color:#8bb398;background:#f4fbf6}.decision-hold{border-color:#d6ba72;background:#fffaf0}.decision-reject{opacity:.72;background:#f7f7f7}.tag.orange{background:#fff4dc;color:#7a570e}.tag.gray{background:#eef0ef;color:#59645d}
@media(max-width:760px){.admin-search-grid{grid-template-columns:1fr}.admin-search-grid .span-2{grid-column:auto}.admin-diff-row{grid-template-columns:1fr}.candidate-rank{min-width:0}.candidate-json-grid{grid-template-columns:1fr}}

/* Version 27.1: pedigree-guided relative input trial */
.guided-input-intro{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0 0 18px}
.guided-input-intro>div{position:relative;padding:16px 16px 16px 54px;border:1px solid #e3d7ba;border-radius:16px;background:linear-gradient(145deg,#fffdf8,#f8f3e8);min-height:86px}
.guided-input-intro strong,.guided-input-intro small{display:block}.guided-input-intro strong{color:#2d342f}.guided-input-intro small{margin-top:4px;color:#6f746f;line-height:1.45}
.guided-step-number{position:absolute;left:14px;top:16px;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#a67616;color:#fff;font-weight:900}
.guided-tree-card{padding-bottom:18px}.guided-tree-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.guided-tree-head h2{margin-bottom:5px}.guided-tree-head p{margin:0;color:#68716b}.guided-tree-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.guided-view-switch{margin:14px 0 10px}.guided-tree-wrap{min-height:310px;border:1px solid #e4e8e5;border-radius:16px;background:#fbfcfb;overflow:auto}.guided-input-canvas{min-width:760px}
.guided-wait-card{text-align:center;border:2px dashed #ccd9d0;background:#f8fbf9}.guided-wait-card h2{margin-top:0}.guided-wait-card p{max-width:720px;margin:0 auto;color:#607068}
.guided-person-form{border-top:6px solid #8caf98}.guided-form-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;margin-bottom:18px}.guided-form-head h2{margin:6px 0}.guided-form-head p{margin:0;color:#657169}
.guided-registered-list details>summary{cursor:pointer;font-weight:900;color:#2d3b32;padding:4px 0}.guided-registered-list details[open]>summary{margin-bottom:14px}
.tree-relative-add-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:760px){
  .guided-input-intro{grid-template-columns:1fr}.guided-input-intro>div{min-height:72px}
  .guided-tree-head,.guided-form-head{flex-direction:column}.guided-tree-actions{justify-content:flex-start}
  .guided-tree-wrap{min-height:260px}.guided-input-canvas{min-width:680px}
  .tree-relative-add-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:430px){.tree-relative-add-grid{grid-template-columns:1fr 1fr}.guided-view-switch{display:grid;grid-template-columns:1fr 1fr}.guided-view-switch button:last-child{grid-column:1/-1}}

/* Version 27.1 input-order refinement: form first, pedigree last */
.guided-form-instruction{margin:18px 0 12px;border-left:5px solid #b5cfae;background:#f3f8f1}
.guided-form-instruction strong{font-size:1.12rem}

/* Version 27.3: popup delete action and deletion impact dialog */
.tree-person-focus-white .focus-actions .btn.danger{
  margin-left:auto;
}
.delete-impact-list{
  margin:14px 0;
  padding:12px 14px;
  border:1px solid #ead8d3;
  border-radius:12px;
  background:#fff8f6;
}
.delete-impact-list p{margin:0 0 8px}
.delete-impact-list ul{margin:0;padding-left:1.25em}
.delete-impact-list li+li{margin-top:4px}
.dialog-warning{
  margin-top:14px;
  color:#8f2f26;
  font-weight:700;
}

/* Version 28.0: simple backup and restore */
.simple-backup-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.simple-backup-actions .backup-large{min-height:58px;display:flex;align-items:center;justify-content:center;text-align:center}
.backup-advanced{margin-top:14px;border-top:1px solid var(--line,#d8dee8);padding-top:12px}
.backup-advanced summary{cursor:pointer;font-weight:700;color:#596579;margin-bottom:10px}
.btn.warning{background:#f2b84b;color:#342500;border-color:#d69b25}
.restore-summary{display:grid;gap:10px;margin:6px 0 16px}
.restore-summary>div{display:grid;grid-template-columns:90px 1fr;gap:12px;align-items:center;padding:10px 12px;border-radius:10px;background:#f6f8fb}
.restore-summary span{font-size:.88rem;color:#657083}
.restore-summary strong{font-size:1rem;word-break:break-word}
@media(max-width:760px){.simple-backup-actions{grid-template-columns:1fr}.restore-summary>div{grid-template-columns:78px 1fr}}

/* Version 28.1: internal automatic backup history */
.internal-backup-panel{margin-top:20px;padding:18px;border:1px solid rgba(25,89,75,.18);border-radius:16px;background:rgba(247,251,249,.9)}
.internal-backup-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}
.internal-backup-heading h3{margin:0 0 4px;font-size:1.08rem}
.internal-backup-heading p{margin:0}
.internal-backup-list{display:grid;gap:9px;max-height:420px;overflow:auto;padding-right:3px}
.internal-backup-item{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;padding:12px 14px;border:1px solid rgba(25,89,75,.14);border-radius:12px;background:#fff;cursor:pointer}
.internal-backup-item:hover{border-color:rgba(25,89,75,.38);box-shadow:0 3px 12px rgba(20,65,55,.07)}
.internal-backup-item input{width:19px;height:19px;accent-color:#176b57}
.internal-backup-main{display:grid;gap:3px;min-width:0}
.internal-backup-main strong{font-size:.97rem}
.internal-backup-main span{font-size:.88rem;color:#526760;white-space:normal}
.internal-backup-reason{font-size:.78rem;padding:4px 8px;border-radius:999px;background:#edf5f1;color:#315d50;white-space:nowrap}
.internal-backup-empty{padding:20px;text-align:center;border:1px dashed rgba(25,89,75,.25);border-radius:12px;color:#61736d;background:#fff}
@media(max-width:720px){.internal-backup-heading{align-items:stretch;flex-direction:column}.internal-backup-heading .btn{width:100%}.internal-backup-item{grid-template-columns:auto minmax(0,1fr)}.internal-backup-reason{grid-column:2;justify-self:start}}
