* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #1d120c;
    color: #f8eadf;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }
.topbar {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
h1 { margin: 0 0 6px; font-size: 32px; }
.subtitle { margin: 0; opacity: .85; }
.picker {
    background: #2a1a12;
    border: 1px solid #7f5a3a;
    border-radius: 12px;
    padding: 12px;
}
.picker label { display: block; margin-bottom: 8px; font-size: 14px; }
.picker select {
    width: 280px;
    max-width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #7f5a3a;
    background: #120b07;
    color: #fff;
}
.info-box, .help-box, .panel, .detail-card {
    background: #2a1a12;
    border: 1px solid #7f5a3a;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.tree-wrapper {
    background: #140b07;
    border: 1px solid #7f5a3a;
    border-radius: 16px;
    padding: 20px;
    overflow: hidden;
}
.tree-scroll { overflow-x: auto; padding-bottom: 12px; }
.tree { min-width: 1000px; }
.tree ul {
    position: relative;
    padding-top: 22px;
    display: flex;
    justify-content: center;
}
.tree li {
    list-style-type: none;
    text-align: center;
    position: relative;
    padding: 22px 10px 0 10px;
}
.tree li::before, .tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #8a6648;
    width: 50%;
    height: 22px;
}
.tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #8a6648;
}
.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before {
    border-right: 2px solid #8a6648;
    border-radius: 0 8px 0 0;
}
.tree li:first-child::after {
    border-radius: 8px 0 0 0;
}
.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #8a6648;
    width: 0;
    height: 22px;
}
.family-pair {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.person-card {
    min-width: 210px;
    max-width: 240px;
    background: #26150e;
    border: 2px solid #4ea5ff;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.person-card.female { border-color: #ff6da6; }
.person-card.male { border-color: #4ea5ff; }
.person-card:hover { transform: translateY(-2px); transition: .2s ease; }
.person-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.person-meta { font-size: 13px; opacity: .88; margin-bottom: 4px; }
.detail-page { max-width: 1000px; }
.back-link {
    display: inline-block;
    margin-bottom: 16px;
    background: #6c4a2e;
    padding: 10px 14px;
    border-radius: 10px;
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}
.panel ul { margin: 0; padding-left: 18px; }
code {
    background: #120b07;
    border: 1px solid #7f5a3a;
    padding: 2px 6px;
    border-radius: 6px;
}
@media (max-width: 768px) {
    .container { padding: 14px; }
    h1 { font-size: 26px; }
    .person-card { min-width: 170px; }
}


.search-box input {
    width: 280px;
    max-width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #7f5a3a;
    background: #120b07;
    color: #fff;
}
.zoom-actions { display:flex; gap:8px; }
.zoom-actions button {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #7f5a3a;
    background: #120b07;
    color: #fff;
    cursor: pointer;
}
.person-photo-wrap { margin-bottom: 8px; display:flex; justify-content:center; }
.person-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:700;
    background:#4d3628;
    color:#fff;
}
.person-photo.placeholder { border: 2px solid rgba(255,255,255,.15); }
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
}
.modal.hidden { display: none; }
.modal-card {
    width: min(560px, 100%);
    background: #2a1a12;
    border: 1px solid #7f5a3a;
    border-radius: 18px;
    padding: 22px;
    position: relative;
}
.modal-close {
    position:absolute;
    top:10px;
    right:10px;
    width:38px;
    height:38px;
    border-radius:50%;
    border:1px solid #7f5a3a;
    background:#120b07;
    color:#fff;
    cursor:pointer;
    font-size:22px;
}
.modal-grid { display:grid; grid-template-columns: 90px 1fr; gap:16px; align-items:start; }
.modal-grid img, .modal-grid .person-photo { width:90px; height:90px; border-radius:16px; object-fit:cover; }
.tree-scroll.grabbing { cursor: grabbing; }
.tree-scroll { cursor: grab; }
