/* 家系図をつくる画面 */
.t-body { background: #fff; }
.t-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 20px; background: linear-gradient(100deg, #5a6270, #4f5663); color: #f4efe4; }
.t-head .top { margin: 0; color: #fbf8f1; }
.t-head .top img { box-shadow: 0 0 0 1px rgba(214,206,190,.5); border-radius: 50%; }
.t-head .top ruby rt { color: #c2bcb0; }
.t-himitsu { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 5px 12px 5px 8px; border-radius: 999px; background: rgba(246,240,228,.1); font-size: .8rem; color: #e3dccb; }
.t-himitsu svg { width: 16px; height: 16px; }
.t-himitsu svg rect, .t-himitsu svg path { fill: #e3dccb; stroke: #e3dccb; }
.t-himitsu svg path { fill: none; }
.t-nav { margin-left: auto; display: flex; gap: 4px; }
.t-nav a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: #e3dccb; font-size: .86rem; }
.t-nav a:hover { background: rgba(246,240,228,.1); }

.t-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fdfbf6; position: sticky; top: 0; z-index: 5; }
.t-bar button { font: inherit; cursor: pointer; letter-spacing: .02em; }
.t-bar svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.seg { display: inline-flex; padding: 3px; background: #eef0f5; border-radius: 12px; }
.seg button { border: 0; background: transparent; color: #3d4766; padding: 7px 14px; border-radius: 9px; font-size: .88rem; margin: 0; }
.seg button.on { background: #fff; color: var(--ai); box-shadow: 0 1px 4px rgba(31,47,82,.15); }
.t-zoom { display: inline-flex; gap: 4px; }
.ic { width: 36px; height: 36px; padding: 0; margin: 0; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ai); font-size: 1.1rem; }
.t-act { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 6px; }
.act { margin: 0; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ai); font-size: .86rem; }
.act:hover, .ic:hover { border-color: var(--tsuki); }

.t-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: calc(100vh - 150px); }
.t-main > * { min-width: 0; }   /* 広い図があっても、欄が画面の外へはみ出さないように */
.t-zuw { position: relative; min-width: 0; }
.t-zuw-in { position: relative; }
/* 上は入れるためのもの、図の下は入れたあとに使うもの */
.t-in-t { font-size: .86rem; color: var(--sub); letter-spacing: .08em; }
.t-out { position: static; border-bottom: 0; }
.t-out-t { flex-basis: 100%; }
body.kara .ato { display: none !important; }
.t-zu.drag { cursor: grabbing; }
.t-zu { cursor: grab; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; height: calc(100vh - 255px); min-height: 420px; }
.t-zu .z-box, .t-zu .z-ui { cursor: pointer; }
.t-gen { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--sub); }
.t-gen select { font: inherit; font-size: .86rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ai); }
.t-find input { font: inherit; font-size: .86rem; padding: 7px 12px; width: 11em; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.ic.wide { width: auto; padding: 0 10px; font-size: .8rem; }
.is-nenpyo .t-gen, .is-nenpyo .t-find { display: none; }
.t-mini { position: absolute; right: 14px; bottom: 14px; width: 176px; max-height: 140px; overflow: hidden; background: rgba(255,255,255,.94); border: 1px solid #cfc8ba; border-radius: 4px; box-shadow: 0 6px 20px rgba(90,98,112,.15); cursor: pointer; z-index: 3; }
.t-mini[hidden] { display: none; }
#mini-in svg { display: block; width: 100%; height: auto; pointer-events: none; }
#mini-in .z-ui { display: none; }
.t-mini-view { position: absolute; border: 1.5px solid #5a6270; background: rgba(90,98,112,.08); pointer-events: none; }
.z-box.hl rect { stroke: #5a6270; stroke-width: 4; animation: hl 1.2s ease-in-out 2; }
@keyframes hl { 50% { stroke: #a9a396; stroke-width: 7; } }
.t-zu { position: relative; overflow: auto; border-right: 1px solid var(--line);
  /* 和紙の上に、やわらかい光がさしこむような地 */
  background-color: #f8f2e6;
  background-image: radial-gradient(ellipse 70% 55% at 50% 18%, rgba(255,252,243,.95), rgba(255,252,243,0) 70%), radial-gradient(rgba(169,150,120,.20) 1px, transparent 1.2px);
  background-size: 100% 100%, 22px 22px; background-attachment: local, local; }
.t-ttl { text-align: center; margin: 22px 0 0; font-size: 1.5rem; letter-spacing: .15em; font-family: var(--mincho); font-weight: 500; color: var(--ai); line-height: 1.55; }
/* 目には見せず、検索サイトと読み上げにだけ伝える見出し */
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.t-ttl:empty { display: none; }
#svgbox { padding: 24px; }
#svgbox svg { display: block; margin: 0 auto; }
.t-hajime { max-width: 30em; margin: 8vh auto; text-align: center; padding: 28px 22px; background: #fff; border-radius: 20px; box-shadow: 0 16px 40px rgba(31,47,82,.08); }
.t-hajime svg { width: 220px; height: auto; margin: 0 auto 6px; display: block; }
.t-hajime-t { font-family: var(--mincho); font-weight: 500; font-size: 1.3rem; color: var(--ai); margin: 6px 0; }
.btn.big { padding: 14px 28px; font-size: 1.02rem; box-shadow: 0 8px 22px rgba(31,47,82,.2); margin-top: 8px; }

.t-panel { padding: 16px; background: #f6f1e6; display: flex; flex-direction: column; gap: 12px; }
.t-card { background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 1px 3px rgba(31,47,82,.05); border: 1px solid #e8e0cf; }
.t-cap { display: block; margin: 0 0 4px; font-size: .78rem; color: var(--sub); letter-spacing: .12em; }
.t-selname { font-family: var(--mincho); font-weight: 500; font-size: 1.45rem; color: var(--ai); margin: 0 0 10px; letter-spacing: .08em; line-height: 1.4; }
.t-panel label { display: block; color: var(--sub); font-size: .8rem; margin: 10px 0 3px; }
.t-panel input[type=text], .t-panel select, .t-panel textarea { width: 100%; font: inherit; font-size: .95rem; padding: 8px 11px; border: 1px solid #e3dccb; border-radius: 10px; background: #fdfaf4; color: var(--ink); }
.t-panel input:focus, .t-panel select:focus, .t-panel textarea:focus { outline: 2px solid rgba(169,163,150,.5); border-color: var(--tsuki); background: #fff; }
.t-panel textarea { min-height: 80px; line-height: 1.7; }
.t-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.t-faq { margin-top: 36px; margin-bottom: 8px; }
.t-faq h2 { font-family: var(--mincho); font-weight: 500; font-size: 1.3rem; letter-spacing: .14em; color: var(--ai); margin: 0 0 14px; }
.t-faq details { background: #fff; border: 1px solid #e8e0cf; border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.t-faq summary { cursor: pointer; color: var(--ink); }
.t-faq details p { margin: 10px 0 2px; color: #45403a; font-size: .94rem; line-height: 1.9; }
.t-hoji { margin: 0 0 6px; padding: 6px 12px; font-size: .86rem; color: var(--ai); background: #f4f2ee; border-left: 3px solid #a9a396; border-radius: 2px; }
.nen-hoji { margin: 0 0 22px; padding: 14px 18px; background: #fff; border: 1px solid #e8e0cf; border-radius: 12px; }
.nen-hoji-t { margin: 0 0 8px; font-family: var(--mincho); font-weight: 500; letter-spacing: .1em; color: var(--ai); }
.nen-hoji ul { margin: 0; padding: 0; list-style: none; }
.nen-hoji li { padding: 5px 0; border-top: 1px dashed #e8e0cf; font-size: .9rem; }
.nen-hoji li:first-child { border-top: 0; }
.nen-hoji .y { display: inline-block; min-width: 10.5em; color: var(--sub); }
.nen-hoji .lnk { padding: 0; font-size: .92rem; }
@media (max-width: 600px) { .nen-hoji .y { display: block; min-width: 0; font-size: .82rem; } }
.t-addcap { margin: 10px 0 6px; font-size: .86rem; color: var(--ink); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.t-addcap .lnk { font-size: .82rem; }
.t-add { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 6px; border-bottom: 1px dashed #e3dccb; margin-bottom: 4px; }
.t-add button { margin: 0; padding: 8px 13px; font-size: .88rem; border-radius: 999px; letter-spacing: .04em; background: var(--ai); }
.t-add button::before { content: "＋"; color: var(--tsuki); margin-right: 4px; }
.t-more { margin-top: 12px; border-top: 1px solid #efe9dc; padding-top: 8px; }
.t-more summary { cursor: pointer; color: var(--ai); font-size: .88rem; padding: 4px 0; }
.t-sp { margin-top: 10px; font-size: .85rem; color: var(--sub); }
.t-sp button { padding: 3px 10px; font-size: .78rem; margin: 0 0 0 6px; border-radius: 8px; background: #fff; color: var(--ai); border: 1px solid var(--line); }
.t-del { margin: 14px 0 0; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lnk { margin: 0; padding: 4px 0; background: none; color: var(--sub); font-size: .82rem; text-decoration: underline; letter-spacing: 0; box-shadow: none; }
.lnk:hover { color: var(--ai); }
#mkbase { margin: 0; padding: 6px 12px; font-size: .82rem; border-radius: 9px; background: var(--kin); color: #3d4766; }
.t-list { display: flex; flex-wrap: wrap; gap: 6px; }
.t-list button { margin: 0; padding: 4px 11px; font-size: .85rem; border-radius: 999px; background: #fdfaf4; color: var(--ink); border: 1px solid #e3dccb; letter-spacing: 0; }
.t-list button.on { border-color: var(--tsuki); background: var(--kin); color: var(--ai); }
.t-list button.soto { color: #a39b8f; }
.t-legend { margin: 8px 0 0; font-size: .76rem; color: #a39b8f; }
.t-safe p { margin: 0 0 6px; font-size: .8rem; line-height: 1.75; color: var(--sub); }
.t-foot { padding-top: 0; }
.t-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ai); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: .9rem; z-index: 10; max-width: 90vw; box-shadow: 0 10px 30px rgba(31,47,82,.3); }

.tg.on { background: var(--ai); color: #f4efe4; border-color: var(--ai); }
.is-nenpyo .t-zoom, .is-nenpyo #tate { display: none; }
.t-selrel { margin: -6px 0 4px; font-size: .84rem; color: var(--sub); line-height: 1.7; }
#mkme { display: block; margin: 0 0 12px; font-size: .8rem; }
#mkme[hidden] { display: none; }
.p-only { display: none; }

/* 7日たったら「ファイルに残す」をすすめる帯 */
.nokosu { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 20px; background: #5a6270 var(--washi); color: #f4efe4; border-bottom: 2px solid #a9a396; }
.nokosu[hidden] { display: none; }
.nokosu p { margin: 0; font-size: .9rem; line-height: 1.7; flex: 1 1 320px; }
.nokosu span { display: inline-flex; align-items: center; gap: 14px; }
.nokosu button { margin: 0; padding: 8px 18px; font-size: .9rem; background: var(--gin); color: #5a6270; }
.nokosu .lnk { background: none; color: #c2bcb0; padding: 4px 0; }

/* 確かめの小窓と、元に戻すボタン */
.ask { width: min(440px, 92vw); border: 0; border-radius: 4px; padding: 24px 24px 20px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.ask::backdrop { background: rgba(20,24,33,.55); }
.ask::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--gin); }
.ask-t { margin: 0 0 8px; font-family: var(--mincho); font-weight: 500; font-size: 1.15rem; color: var(--ai); letter-spacing: .06em; }
.ask-b { margin: 0 0 18px; font-size: .88rem; color: var(--sub); line-height: 1.8; }
.ask-btns { display: flex; justify-content: flex-end; gap: 10px; }
.ask-btns button { margin: 0; padding: 9px 20px; font-size: .92rem; }
.t-toast { display: flex; align-items: center; gap: 14px; }
.t-toast[hidden] { display: none; }
.toast-b { margin: 0; padding: 5px 12px; font-size: .84rem; background: var(--gin); color: #5a6270; border-radius: 4px; letter-spacing: .06em; white-space: nowrap; }

/* 戸籍から読みこむ */
.ky { width: min(920px, 94vw); max-height: 90vh; border: 0; border-radius: 4px; padding: 22px 26px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.35); background: #fff var(--washi); }
.ky::backdrop { background: rgba(20,24,33,.55); }
.ky::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--gin); }
.ky-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ky-t { margin: 0; font-family: var(--mincho); font-weight: 500; font-size: 1.35rem; letter-spacing: .14em; color: var(--ai); }
.ky p { font-size: .92rem; }
.ky-note { margin: 0 0 14px; padding: 12px 14px 12px 32px; background: #f6f1e6; border-radius: 4px; }
.ky-note li { font-size: .84rem; color: #45403a; }
.ky-pick { display: inline-block; padding: 10px 18px; border: 1px dashed #a9a396; border-radius: 4px; cursor: pointer; color: var(--ai); font-size: .92rem; }
.ky-pick input { display: block; margin-top: 6px; font-size: .82rem; }
.ky-files { color: var(--sub); font-size: .84rem; }
.ky-msg { margin: 18px 0 8px; color: var(--ai); }
.ky progress { width: 100%; height: 8px; accent-color: #5a6270; }
.ky-shi { display: inline-flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--sub); margin-bottom: 10px; }
.ky input[type=text] { font: inherit; font-size: .9rem; padding: 6px 8px; border: 1px solid #e3dccb; border-radius: 4px; background: #fff; }
.ky select { font: inherit; font-size: .9rem; padding: 5px; border: 1px solid #e3dccb; border-radius: 4px; }
.ky-han { border: 1px solid #e8e0cf; border-radius: 4px; padding: 8px 14px 10px; margin: 0 0 12px; }
.ky-han legend { font-size: .78rem; color: var(--sub); letter-spacing: .1em; padding: 0 6px; }
.ky-han label { display: block; font-size: .88rem; margin: 4px 0; cursor: pointer; }
.ky-han label[hidden] { display: none; }
.ky-han select { margin-left: 8px; }
.ky-scroll { overflow-x: auto; border: 1px solid #e8e0cf; border-radius: 4px; }
.ky-tb { border-collapse: collapse; min-width: 760px; width: 100%; }
.ky-tb th { font-size: .76rem; color: var(--sub); font-weight: 400; text-align: left; padding: 8px 6px; background: #f6f1e6; letter-spacing: .1em; }
.ky-tb td { padding: 6px; border-top: 1px solid #f4efe4; font-size: .88rem; }
.ky-z { color: var(--sub); white-space: nowrap; }
.ky-raw { margin-top: 12px; font-size: .82rem; color: var(--sub); }
.ky-raw pre { white-space: pre-wrap; max-height: 160px; overflow: auto; background: #fbf8f1; padding: 10px; border-radius: 4px; font-size: .78rem; }
.ky-btns { display: flex; gap: 18px; align-items: center; margin-top: 16px; }

/* 年表「先祖の歩み」 */
.nen { max-width: 760px; margin: 0 auto; padding: 28px 24px 40px; }
.nen-t { text-align: center; font-size: 1.5rem; letter-spacing: .3em; margin: 0 0 22px; }
.nen-empty, .nen-none, .nen-note { color: var(--sub); font-size: .88rem; }
.nen-note { font-size: .78rem; margin-top: 18px; }
.nen-list { list-style: none; margin: 0; padding: 0; position: relative; }
.nen-list::before { content: ""; position: absolute; left: 132px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, #cfc8ba, #6a7280); }
.nen-row { display: grid; grid-template-columns: 116px 1fr; gap: 32px; align-items: center; padding: 6px 0; position: relative; }
.nen-row::before { content: ""; position: absolute; left: 127px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid #6a7280; }
.nen-row.d::before { background: #6a7280; }
.nen-y { text-align: right; line-height: 1.35; }
.nen-y .n { display: block; font-family: var(--mincho); font-weight: 500; font-size: 1.15rem; color: var(--ai); letter-spacing: .04em; }
.nen-y .w { display: block; font-size: .74rem; color: var(--sub); }
.nen-e { text-align: left; margin: 0; padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid #e8e0cf; color: var(--ink); font-size: .92rem; letter-spacing: 0; box-shadow: 0 1px 3px rgba(90,98,112,.05); cursor: pointer; }
.nen-e:hover { border-color: #a9a396; }
.nen-row.on .nen-e { border-color: var(--ai); box-shadow: 0 0 0 1px var(--ai); }
.nen-e .nm { font-family: var(--mincho); font-weight: 500; font-size: 1.05rem; color: var(--ai); }
.nen-e small { margin-left: 10px; padding: 1px 8px; border-radius: 999px; background: #f4efe4; color: #3d4766; font-size: .74rem; }
.nen-e small.shu { background: #5a6270; color: #e8e0cf; }
.nen-era { margin: 10px 0 10px 120px; padding: 4px 12px; font-size: .78rem; letter-spacing: .2em; color: #6a7280; position: relative; }
.nen-era::before { content: ""; position: absolute; left: 4px; top: 50%; width: 16px; height: 1px; background: #6a7280; }
@media (max-width: 600px) {
  .nen { padding: 20px 12px 30px; }
  .nen-list::before { left: 82px; }
  .nen-row { grid-template-columns: 70px 1fr; gap: 24px; }
  .nen-row::before { left: 77px; }
  .nen-y .n { font-size: 1rem; }
  .nen-era { margin-left: 74px; }
}

/* 図の中 */
.z-box { cursor: pointer; }
.z-box rect { fill: #fffdf7; stroke: #cfc8ba; stroke-width: 1.2; }
.t-mini svg * { filter: none !important; }
.z-box.m rect { stroke: #6a7280; }
.z-box.f rect { stroke: #c3b9b0; }
.z-box.den rect { stroke-dasharray: 5 4; }
.z-box.fumei rect { fill: var(--soft); }
.z-box:hover rect { stroke: var(--tsuki); }
.z-box.sel rect { stroke: var(--ai); stroke-width: 2.6; filter: drop-shadow(0 0 5px rgba(169,163,150,.7)); }
.z-box .nm { font-family: var(--mincho); font-weight: 500; font-size: 16px; fill: var(--ink); letter-spacing: .06em; }   /* 家系図の名前は、日本風の明朝 */
.z-box .yo { font-family: var(--gothic); font-size: 10px; fill: var(--sub); }
.z-box .dt { font-family: var(--gothic); font-size: 10px; fill: var(--sub); }
.z-box .shu { font-family: var(--gothic); font-size: 10.5px; fill: #5a6270; letter-spacing: .04em; }
.z-box .tag { font-family: var(--gothic); font-size: 9.5px; fill: #6a7280; }
.z-box .ck { font-family: var(--gothic); font-size: 10px; fill: #5a6270; letter-spacing: .08em; }
.z-line { stroke: #4a4a52; stroke-width: 1.3; fill: none; }
/* 兄弟姉妹をたたむ・開くボタン */
.z-ui { cursor: pointer; }
.z-ui rect { fill: #f4efe4; stroke: #a9a396; stroke-width: .8; }
.z-ui text { font-family: var(--gothic); font-size: 9px; fill: #5a6270; letter-spacing: .04em; }
.z-ui:hover rect, .z-ui:focus rect { fill: #5a6270; } .z-ui:hover text, .z-ui:focus text { fill: #f4efe4; }
@media print { .z-ui { display: none; } }

@media (max-width: 900px) {
  .t-main { grid-template-columns: minmax(0, 1fr); }
  .t-zu { border-right: 0; border-bottom: 1px solid var(--line); height: 62vh; max-height: 62vh; min-height: 320px; }
  .t-find input { width: 9em; }
  .t-mini { width: 120px; max-height: 96px; right: 10px; bottom: 10px; }
  .t-nav { display: none; }
  .t-act { margin-left: 0; }
  .t-bar { position: static; }
}
@media (max-width: 600px) {
  .t-head { padding: 12px 16px 8px; gap: 10px; }
  .t-bar { padding: 8px 16px; gap: 8px; }
  .seg button { padding: 7px 9px; font-size: .8rem; }
  .seg svg { display: none; }
  .act { padding: 7px 10px; font-size: .82rem; }
  .act .lg, .seg .lg { display: none; }
  .t-hajime { margin: 20px 16px; padding: 22px 16px; }
  .t-panel { padding: 12px; }
}

@media print {
  @page { size: landscape; margin: 10mm; }
  .t-head, .t-bar, .t-panel, .t-foot, .t-faq, .t-toast, .t-hajime, .t-mini, .nokosu { display: none !important; }
  .t-zu { height: auto !important; min-height: 0; }
  .t-main { display: block; min-height: 0; }
  /* 作品として：二重の枠、大きな題、作った日 */
  .t-zu { overflow: visible; background: #fff; max-height: none; border: 3px double #5a6270; padding: 8mm 10mm 6mm; min-height: 180mm; display: flex; flex-direction: column; }
  .t-ttl { display: none; }
  .p-only { display: block; }
  .p-title { text-align: center; font-family: var(--mincho); font-weight: 500; font-size: 26pt; letter-spacing: .4em; color: #5a6270; margin: 0 0 6mm; }
  .p-kamon { text-align: center; font-family: var(--mincho); font-weight: 500; font-size: 11pt; letter-spacing: .3em; color: #6a7280; margin: -4mm 0 5mm; }
  .p-kamon[hidden] { display: none; }
  .p-foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 4mm; border-top: 1px solid #cfc8ba; font-size: 9pt; color: #6e665c; letter-spacing: .15em; }
  #svgbox { padding: 0; flex: 1; display: flex; align-items: center; justify-content: center; }
  .nen-e { box-shadow: none; }
  #svgbox svg { width: 100% !important; height: auto !important; max-height: 140mm; filter: none; }
  .z-box.sel rect { stroke: #cfc8ba; stroke-width: 1.2; }
  /* 清書の型：和紙の色、青鈍と銀の二重の枠、右に縦書きの題、左に作った日。名前は枠をなくして、墨の線でつなぐ */
  body.seisho .t-zu { position: relative; flex-direction: row-reverse; align-items: stretch; background: #fbf8f1 var(--washi); border: 1.6pt solid #5a6270; padding: 12mm 12mm 10mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.seisho .t-zu::before { content: ""; position: absolute; inset: 3.2mm; border: .6pt solid #a9a396; pointer-events: none; }
  body.seisho .p-head { writing-mode: vertical-rl; display: flex; flex-direction: column; gap: 4mm; margin: 0 0 0 8mm; padding: 4mm 0 0 7mm; border-left: .6pt solid #a9a396; }
  body.seisho .p-title { text-align: start; font-size: 30pt; letter-spacing: .55em; color: #4a515d; margin: 0; }
  body.seisho .p-kamon { margin: 0; padding-top: 2mm; font-size: 11pt; letter-spacing: .35em; text-align: start; }
  body.seisho .p-foot { writing-mode: vertical-rl; margin: 0 8mm 0 0; padding: 4mm 5mm 0 0; border-top: 0; border-right: .6pt solid #a9a396; color: #6a7280; letter-spacing: .3em; }
  body.seisho #svgbox svg { max-height: 165mm; }
  body.seisho .z-box rect { fill: none; stroke: none; }
  body.seisho .z-box .phm { display: none; }
  body.seisho .z-box .nm { fill: #1f2329; }
  body.seisho .z-box .dt, body.seisho .z-box .tag { fill: #5a6270; }
  body.seisho .z-line { stroke: #2f343d; stroke-width: 1; }
}
.t-kamon-cap { display: block; margin-top: 12px; }
/* うまく動かない時のお知らせ（姓名月と同じ形。写真の欄はつけない） */
.tr-wrap { text-align: center; margin: 14px 0 6px; }
.tr-btn { background: #fff; color: var(--ai); border: 1px solid #cfc8ba; border-radius: 999px; padding: 6px 16px; font-size: .84rem; box-shadow: none; letter-spacing: .04em; margin: 0; cursor: pointer; }
.tr-btn:hover { border-color: var(--ai); }
.tr-dlg { width: min(460px, 94vw); border: 0; border-radius: 4px; padding: 22px 22px 18px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.tr-dlg::backdrop { background: rgba(20,24,33,.55); }
.tr-dlg::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--gin); }
.tr-close { position: absolute; right: 8px; top: 8px; margin: 0; padding: 4px 10px; background: transparent; color: var(--sub); box-shadow: none; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.tr-h { margin: 0 0 4px; font-family: var(--mincho); font-weight: 500; color: var(--ai); font-size: 1.15rem; letter-spacing: .06em; }
.tr-lead { margin: 0 0 6px; font-size: .86rem; color: var(--sub); }
.tr-k { display: block; font-size: .84rem; color: var(--ink); margin: 12px 0 6px; }
.tr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-chip { position: relative; }
.tr-chip input { position: absolute; opacity: 0; }
.tr-chip span { display: inline-block; border: 1px solid #cfc8ba; border-radius: 999px; padding: 4px 12px; font-size: .82rem; background: #fff; color: var(--ai); cursor: pointer; }
.tr-chip input:checked + span { background: var(--ai); color: #f4efe4; border-color: var(--ai); }
.tr-chip input:focus-visible + span { outline: 2px solid rgba(169,163,150,.6); }
.tr-dlg textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: .92rem; padding: 8px 11px; border: 1px solid #e3dccb; border-radius: 10px; background: #fdfaf4; }
.tr-dlg textarea::placeholder { color: #a39b8f; }
.tr-send { display: block; width: 100%; margin-top: 14px; }
.tr-cf { margin-top: 12px; min-height: 0; }
.tr-cf:empty { display: none; }
.tr-msg { min-height: 1.4em; font-size: .85rem; color: var(--ai); margin: 6px 0 0; }
.tr-done { margin: 14px 0 4px; text-align: center; font-family: var(--mincho); font-weight: 500; font-size: 1.1rem; color: var(--ai); }
.tr-done-s { margin: 0 0 12px; text-align: center; font-size: .88rem; color: var(--sub); }
@media print { .tr-wrap { display: none !important; } }
/* 扇の形の図 */
.z-fan .z-box path { fill: #fffdf7; stroke: #cfc8ba; stroke-width: 1.2; }
.z-fan .z-box.m path { stroke: #9aa1ad; }
.z-fan .z-box.f path { stroke: #c3b9b0; }
.z-fan .z-box.den path { stroke-dasharray: 5 4; }
.z-fan .z-box.fumei path { fill: var(--soft); }
.z-fan .z-box:hover path { fill: #f4f2ee; }
.z-fan .z-box.sel path { stroke: var(--ai); stroke-width: 2.4; fill: #f4f2ee; }
.z-fan .z-box.aki path { fill: rgba(255,255,255,.45); stroke: #cfc8ba; stroke-dasharray: 3 4; }
.z-fan .z-box.aki .tag { fill: #9aa1ad; font-size: 11px; }
.z-fan .z-box.aki:hover path { fill: #fff; stroke: var(--ai); }
.z-fan .z-box.hl path { stroke: #5a6270; stroke-width: 4; }
@media print { .z-fan .z-box.aki { display: none; } .z-fan .z-box.sel path { stroke: #cfc8ba; stroke-width: 1.2; fill: #fffdf7; } }
.is-ougi #tate { display: none; }
.is-down #both, .is-ougi #both, .is-nenpyo #both, .is-nenpyo .t-jiku { display: none; }
.is-ougi #chiiki, .is-nenpyo #chiiki,
.is-down #sibs, .is-ougi #sibs, .is-nenpyo #sibs, .is-down #sibsp, .is-ougi #sibsp, .is-nenpyo #sibsp, .is-down #itoko, .is-ougi #itoko, .is-nenpyo #itoko { display: none; }
.t-jiku select { max-width: 11em; }
.z-fan .fan-sum { font-family: var(--gothic); font-size: 12px; fill: var(--sub); letter-spacing: .06em; }
.seg button { white-space: nowrap; }
/* ゆかりの土地 */
.tochi { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }
.tochi-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tochi-list li { padding: 10px 14px; background: #fff; border: 1px solid #e8e0cf; border-left: 3px solid #a9a396; border-radius: 0 10px 10px 0; }
.tochi-k { margin: 0; font-family: var(--mincho); font-weight: 500; font-size: 1.05rem; color: var(--ai); letter-spacing: .08em; }
.tochi-k small { margin-left: 10px; font-family: var(--gothic); font-size: .76rem; color: var(--sub); letter-spacing: 0; }
.tochi-w { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.tochi-w .lnk { margin: 0; padding: 0; font-size: .88rem; }
/* 印刷の型をえらぶ小窓 */
.kata-k { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 16px; }
.kata-k button { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; padding: 14px 10px 12px; background: #fff; color: var(--ai); border: 1px solid var(--line); border-radius: 10px; box-shadow: none; cursor: pointer; }
.kata-k button:hover, .kata-k button:focus-visible { border-color: var(--ai); }
.kata-k svg { width: 96px; height: 66px; }
.kata-k span { font-family: var(--mincho); font-weight: 500; font-size: 1.02rem; letter-spacing: .1em; }
.kata-k small { font-size: .76rem; color: var(--sub); line-height: 1.6; }
.kata-k button[hidden] { display: none; }
.kata-muki { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; padding: 0; border: 0; }
.kata-muki legend { padding: 0; margin: 0 0 6px; font-size: .8rem; color: var(--sub); letter-spacing: .1em; }
.kata-muki label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ai); font-size: .9rem; cursor: pointer; }
.kata-muki label:has(input:checked) { border-color: var(--ai); background: #f4f2ee; }
.kata-muki input { margin: 0; accent-color: #5a6270; }
.kata-muki svg { width: 22px; height: 17px; }
@media print {
  /* 縦向きの紙：枠を縦に長く、図も縦いっぱいまで */
  body.p-tate .t-zu { min-height: 265mm; }
  body.p-tate #svgbox svg { max-height: 225mm; }
  body.p-tate.seisho #svgbox svg { max-height: 240mm; }
}

/* ---- 写真 ---- */
.t-selhead { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; }
.t-selhead .t-selname { margin: 0; }
.t-phadd { font-size: .8rem; padding: 0; margin: 2px 0 0; }
.t-thumb { flex: none; width: 56px; height: 56px; padding: 0; margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid #cfc8ba; background: #f4efe4; cursor: zoom-in; box-shadow: none; }
.t-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.z-box .phm rect { fill: #fffdf7; stroke: #a9a396; stroke-width: 1.2; }
.z-box .phm circle { fill: none; stroke: #a9a396; stroke-width: 1.2; }
.phv { width: min(520px, 94vw); text-align: center; }
.phv img { max-width: 100%; max-height: 62vh; border-radius: 10px; display: block; margin: 0 auto 10px; }
.phv .ask-btns { justify-content: center; flex-wrap: wrap; }

/* ---- 法事とカレンダー ---- */
.t-hoji { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.t-hoji .lnk { font-size: .8rem; padding: 0; margin: 0; }
.nen-ics { margin: 8px 0 0; padding: 0; font-size: .86rem; }

/* ---- 聞き取りの手帳 ---- */
.t-kiki summary span { color: var(--sub); font-size: .82rem; margin-left: 6px; }
.t-kiki-note { font-size: .82rem; color: var(--sub); line-height: 1.7; margin: 8px 0 4px; }
.t-kiki textarea { min-height: 3.2em; }

/* ---- 年表：その時代の出来事 ---- */
.nen-jidai-sw { display: inline-flex; align-items: center; gap: 4px; font-size: .86rem; color: var(--sub); margin: 0 0 12px; cursor: pointer; }
.nen-ji { list-style: none; margin: 6px 0 10px 120px; padding: 8px 14px; border-left: 3px solid #cfc8ba; background: #f7f4ee; border-radius: 0 10px 10px 0; position: relative; }
.nen-ji-t { margin: 0; font-size: .9rem; color: var(--ink); }
.nen-ji-t .y { color: var(--sub); margin-right: 10px; font-size: .84rem; }
.nen-ji-w { margin: 2px 0 0; font-size: .8rem; color: var(--sub); line-height: 1.7; }
@media (max-width: 600px) { .nen-ji { margin-left: 0; } }

/* ---- スマホ：入力の欄を、画面の下から出す ---- */
.t-sheet-x { display: none; }
@media (max-width: 899px) {
  body.sheet #edit { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    margin: 0; border-radius: 18px 18px 0 0; border: 0; border-top: 1px solid #e8e0cf; box-shadow: 0 -12px 34px rgba(42,38,32,.18); padding-top: 26px; }
  body.sheet #edit::before { content: ""; position: absolute; top: 9px; left: 50%; width: 42px; height: 4px; margin-left: -21px; border-radius: 2px; background: #d8d2c4; }
  body.sheet .t-sheet-x { display: block; position: sticky; top: -16px; float: right; margin: -16px -4px 0 8px; padding: 6px 14px; font-size: .84rem; border-radius: 999px; z-index: 2; }
  body.sheet .t-zu { max-height: 40vh; height: 40vh; min-height: 0; }
  body.sheet .t-toast { bottom: auto; top: 14px; z-index: 30; }
  body.sheet { padding-bottom: 60vh; }
}
.t-thumb[hidden], .t-phadd[hidden], .t-hoji .lnk[hidden] { display: none !important; }
/* display を付けた欄でも、hidden のときは必ず消す（法事の欄が前の人のまま残らないように） */
[hidden] { display: none !important; }

/* ---- 家の物語 ---- */
.story-ctl { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px; margin: 0 0 22px; font-size: .86rem; color: var(--sub); }
.story-ctl select { font: inherit; font-size: .88rem; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ai); }
.story-ctl .nen-jidai-sw { margin: 0; }
.story-g { margin: 0 0 26px; }
.story-h { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid #e3dccb; font-family: var(--mincho); font-weight: 500; font-size: 1.12rem; letter-spacing: .14em; color: var(--ai); }
.story-p { margin: 0 0 14px; font-size: .95rem; line-height: 2; color: var(--ink); }
.story-n { display: block; margin: 0 0 2px; padding: 0; font-family: var(--mincho); font-weight: 500; font-size: 1.02rem; color: var(--ai); text-decoration: none; letter-spacing: .08em; }
.story-n:hover { text-decoration: underline; }
@media print { .story-ctl { display: none !important; } .story-p { font-size: 10.5pt; } }

/* ---- 西暦の添え書きと、元号の早見 ---- */
.t-sei { margin: 4px 0 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: .8rem; color: var(--sub); }
.t-sei .lnk { font-size: .8rem; padding: 0; }
.gengo { width: min(460px, 94vw); }
.gengo-w { max-height: 56vh; overflow-y: auto; border: 1px solid #e8e0cf; border-radius: 4px; margin-bottom: 14px; }
.gengo-tb { width: 100%; border-collapse: collapse; font-size: .86rem; }
.gengo-tb th { position: sticky; top: 0; background: #f6f1e6; color: var(--sub); font-weight: 400; font-size: .78rem; text-align: left; padding: 6px 8px; }
.gengo-tb td { padding: 5px 8px; border-top: 1px solid #f4efe4; }
.gengo-tb tr.edo-s td { border-top: 2px solid #cfc8ba; }

/* ---- ゆかりの名字 ---- */
/* 題の下に一列。多いときは横に動かして見る */
.t-myoji { position: sticky; left: 0; display: flex; flex-wrap: nowrap; justify-content: safe center; gap: 5px; max-width: min(56em, 100%); margin: 6px auto 0; padding: 2px 16px 6px; overflow-x: auto; scrollbar-width: thin; }
.t-myoji-b { flex: none; margin: 0; padding: 1px 9px; font-size: .76rem; border-radius: 999px; background: rgba(255,255,255,.7); color: var(--sub); border: 1px solid #e3dccb; box-shadow: none; letter-spacing: .06em; cursor: pointer; }
.t-myoji-b:hover { border-color: #a9a396; color: var(--ai); }
.t-myoji-b.on { background: #5a6270; color: #f4efe4; border-color: #5a6270; }
.z-box.hlm rect, .z-fan .z-box.hlm path { stroke: #5a6270; stroke-width: 3.4; fill: #eef0f3; }
.myo-d { margin: 4px 0 0; font-size: .86rem; color: var(--ink); line-height: 1.7; }
.myo-ppl { margin-top: 6px; }
.myo-ppl summary { cursor: pointer; color: var(--ai); font-size: .84rem; }
@media print { .t-myoji { display: none !important; } .z-box.hlm rect { stroke: #cfc8ba; stroke-width: 1.2; fill: #fffdf7; } }

/* ---- パソコン：図と下のボタンの段、右の欄を、画面の高さに収める ---- */
@media screen and (min-width: 901px) {
  .t-main { height: calc(100vh - var(--th, 112px)); min-height: 380px; }
  .t-zuw { display: flex; flex-direction: column; min-height: 0; }
  .t-zuw-in { flex: 1 1 auto; min-height: 0; }
  .t-zu { height: 100%; min-height: 0; }
  .t-out, .t-zuw .tr-wrap { flex: none; }
  /* 右の欄は、その中だけを上下に動かす */
  .t-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
/* ==== 2026-10-21 作り直し：上は一本の帯、図の下は一段、右の欄はひと回り小さく ==== */
/* 上の帯：先祖歴の名前・探す・読みこむ・ほかのページ */
.t-head { padding: 7px 18px; gap: 14px; flex-wrap: nowrap; }
.t-himitsu { padding: 3px 10px 3px 7px; font-size: .74rem; white-space: nowrap; }
.t-in { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.t-nav { margin-left: 4px; }
.t-nav a { padding: 5px 10px; font-size: .82rem; white-space: nowrap; }
.hb { margin: 0; display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 8px; border: 1px solid rgba(233,227,214,.35); background: transparent; color: #f4efe4; font: inherit; font-size: .82rem; cursor: pointer; box-shadow: none; white-space: nowrap; letter-spacing: .02em; }
.hb:hover { background: rgba(246,240,228,.12); }
.hb svg { width: 15px; height: 15px; }
.t-head .t-find input { width: 10em; padding: 6px 12px; font-size: .82rem; color: #f4efe4; background: rgba(255,255,255,.1); border: 1px solid rgba(233,227,214,.3); }
.t-head .t-find input::placeholder { color: #c9c3b6; }

/* 図の下の段：見方 ｜ 表示 ｜ 残す */
.t-out { flex-wrap: nowrap; gap: 8px; padding: 6px 14px; border-bottom: 0; background: #fbf9f4; }
.seg { padding: 2px; }
.seg button { padding: 6px 11px; font-size: .82rem; }
.seg svg { width: 14px; height: 14px; }
.act { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }
.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; user-select: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop > summary::after { content: ""; width: 6px; height: 6px; margin-left: 7px; border-right: 1.3px solid currentColor; border-bottom: 1.3px solid currentColor; transform: rotate(-135deg) translate(-1px, -1px); }
.pop[open] > summary { border-color: var(--ai); background: #f4f2ee; }
.t-nokosu { margin-left: auto; }
/* 一覧は上へ開く（段が画面の下にあるため） */
.pop-in { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 30; min-width: 230px; padding: 8px; background: #fff; border: 1px solid #e3dccb; border-radius: 10px; box-shadow: 0 14px 34px rgba(42,38,32,.16); }
.t-nokosu .pop-in { left: auto; right: 0; }
.pop-t { margin: 2px 8px 4px; font-size: .72rem; color: var(--sub); letter-spacing: .1em; }
.ck-b { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0; padding: 7px 8px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--ink); font: inherit; font-size: .86rem; text-align: left; cursor: pointer; letter-spacing: .02em; }
.ck-b::before { content: ""; flex: none; width: 14px; height: 14px; border: 1.3px solid #a9a396; border-radius: 3px; background: #fff; }
.ck-b.on::before { background: #5a6270 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.2l2.6 2.6L11 4.4' fill='none' stroke='%23fff' stroke-width='1.8'/%3E%3C/svg%3E") center/12px no-repeat; border-color: #5a6270; }
.ck-b:hover, .ck-b.tg.on:hover { background: #f4f2ee; }
.ck-b.tg.on { background: none; color: var(--ink); border: 0; }
.pop-sel { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 6px 8px; font-size: .82rem; color: var(--sub); border-top: 1px dashed #ece5d6; white-space: nowrap; }
.t-hyoji .pop-in { min-width: 260px; }
.pop-sel + .pop-sel { border-top: 0; }
.pop-sel select { font: inherit; font-size: .84rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ai); max-width: 11em; }
.pop-b { display: block; width: 100%; margin: 0; padding: 8px 10px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--ai); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; }
.pop-b small { display: block; margin-top: 1px; font-size: .72rem; color: var(--sub); }
.pop-b:hover { background: #f4f2ee; }

/* 大きく・小さく・全体は、図の左下に重ねる */
.t-zuw-in > .t-zoom { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: inline-flex; gap: 3px; padding: 3px; background: rgba(255,255,255,.92); border: 1px solid #e3dccb; border-radius: 10px; }
.is-nenpyo .t-zuw-in > .t-zoom { display: none; }
.is-nenpyo .t-head .t-find { display: inline-block; }
.t-zoom .ic { width: 28px; height: 28px; font-size: .95rem; border: 0; border-radius: 7px; }
.t-zoom .ic:hover { background: #f4f2ee; }
.t-zoom .ic.wide { width: auto; font-size: .76rem; padding: 0 9px; }
.t-zuw .tr-wrap { margin: 2px 0 4px; }
.tr-btn { padding: 3px 14px; font-size: .76rem; }

/* 右の欄：字とボタンをひと回り小さく、枠と影を少なく */
.t-main { grid-template-columns: minmax(0, 1fr) 340px; }
.t-panel { padding: 10px; gap: 10px; background: #f7f4ee; }
.t-card { padding: 14px; border-radius: 12px; box-shadow: none; border: 1px solid #ece5d6; }
.t-cap { font-size: .72rem; }
.t-selname { font-size: 1.22rem; margin: 0 0 6px; }
.t-selrel { font-size: .8rem; }
.t-hoji { margin: 0 0 4px; padding: 4px 10px; font-size: .82rem; }
.t-addcap { margin: 8px 0 5px; font-size: .82rem; }
.t-add { gap: 5px; padding-bottom: 8px; }
.t-add button { padding: 5px 11px; font-size: .8rem; }
.t-panel label { margin: 8px 0 2px; font-size: .74rem; }
.t-panel input[type=text], .t-panel select, .t-panel textarea { padding: 6px 10px; font-size: .88rem; border-radius: 8px; }
.t-panel textarea { min-height: 64px; }
.t-row { gap: 8px; }
.t-more summary { font-size: .82rem; }
.t-sp { font-size: .8rem; }
.t-sp-c { margin: 0 0 4px; font-size: .74rem; color: var(--sub); }
.t-sp-r { padding: 8px 0; border-top: 1px dashed #ece5d6; }
.t-sp-h { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: .86rem; }
.t-kon label { margin-top: 4px; }
.t-list button { font-size: .8rem; padding: 3px 10px; }
.t-safe p { font-size: .76rem; }
.t-thumb { width: 48px; height: 48px; }
@media print { .t-zuw-in > .t-zoom, .pop { display: none !important; } }

/* スマホ・せまい画面 */
@media (max-width: 899px) {
  .t-main { grid-template-columns: minmax(0, 1fr); }
  .t-head { flex-wrap: wrap; gap: 8px 10px; }
  .t-himitsu span { display: none; }
  .t-in { flex-wrap: wrap; }
  .t-head .t-find input { width: 7em; padding: 5px 10px; }
  .t-in { gap: 5px; }
  .hb { padding: 5px 9px; font-size: .76rem; }
  .hb .lg { display: none; }
  .t-out { flex-wrap: wrap; }
}
