/* 族谱网站样式 */
:root {
    --admin-bg: #f7f3ea;
    --admin-card: #fffdf8;
    --admin-card-strong: #fff9ed;
    --admin-ink: #243b35;
    --admin-muted: #7d8179;
    --admin-line: #e8dfd0;
    --admin-primary: #245c4f;
    --admin-primary-strong: #17443a;
    --admin-gold: #c79542;
    --admin-danger: #c8523b;
    --admin-success: #2a9d8f;
    --admin-shadow: 0 18px 45px rgba(45, 37, 24, 0.09);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(199, 149, 66, 0.18), transparent 34%),
        linear-gradient(135deg, #fbf8ef 0%, var(--admin-bg) 48%, #f1eadb 100%);
    color: var(--admin-ink);
    padding: 18px;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 22px 24px;
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(232, 223, 208, 0.85);
    border-radius: 24px;
    box-shadow: var(--admin-shadow);
    backdrop-filter: blur(10px);
}

header h1 {
    color: var(--admin-primary);
    margin-bottom: 6px;
    font-size: 2rem;
    letter-spacing: 0.02em;
}

header p {
    color: var(--admin-muted);
    font-size: 1rem;
}

.header-main {
    min-width: 240px;
}

.header-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.family-stats {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 9px 14px;
    border-radius: 999px;
    background-color: #f4ead9;
    color: var(--admin-primary);
    font-size: 0.95rem;
    white-space: nowrap;
}

.user-menu {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(232, 223, 208, 0.9);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.94);
    box-shadow: 0 10px 24px rgba(45, 37, 24, 0.08);
}

.user-menu.compact {
    box-shadow: none;
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--admin-primary);
    color: #fff;
    font-weight: 700;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-text {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.user-name {
    max-width: 160px;
    overflow: hidden;
    color: var(--admin-ink);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    color: var(--admin-muted);
    font-size: 0.76rem;
    line-height: 1.2;
}

.user-link {
    padding: 7px 10px;
    border: none;
    border-radius: 999px;
    background: #e9f4ef;
    color: var(--admin-primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    text-decoration: none;
    white-space: nowrap;
}

.user-link:hover {
    background: var(--admin-primary);
    color: #fff;
}

.user-link-button {
    appearance: none;
}

.search-panel {
    width: 100%;
    margin: 0 0 18px;
    position: relative;
}

.search-box {
    display: flex;
    width: 100%;
    border-radius: 16px;
    box-shadow: var(--admin-shadow);
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 13px 16px;
    border: 1px solid var(--admin-line);
    border-right: none;
    border-radius: 16px 0 0 16px;
    background: rgba(255, 253, 248, 0.96);
    color: var(--admin-ink);
    font-size: 16px;
}

.search-box input:focus {
    outline: 2px solid rgba(199, 149, 66, 0.25);
    border-color: var(--admin-gold);
}

.search-box button {
    padding: 13px 20px;
    background-color: var(--admin-primary);
    color: white;
    border: 1px solid var(--admin-primary);
    border-radius: 0 16px 16px 0;
    cursor: pointer;
}

.search-results {
    display: none;
    margin-top: 10px;
    background: rgba(255, 253, 248, 0.98);
    border: 1px solid var(--admin-line);
    border-radius: 18px;
    box-shadow: var(--admin-shadow);
    max-height: 440px;
    overflow-y: auto;
}

.search-results.active {
    display: block;
}

.search-empty {
    padding: 14px 16px;
    color: var(--admin-muted);
    text-align: center;
}

.search-results-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(255, 253, 248, 0.96);
    border-bottom: 1px solid #f0e7d7;
    color: var(--admin-muted);
    font-size: 0.86rem;
    backdrop-filter: blur(8px);
}

.search-results-header strong {
    color: var(--admin-primary);
    font-size: 0.94rem;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 15px;
    border-bottom: 1px solid #f0e7d7;
    cursor: pointer;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #fff7e7;
}

.search-result-main {
    min-width: 0;
    flex: 1;
}

.search-result-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.search-result-title strong {
    color: var(--admin-primary-strong);
    font-size: 1rem;
}

.search-result-title span {
    padding: 2px 8px;
    background: #f7f0df;
    color: #806331;
    border-radius: 999px;
    font-size: 0.78rem;
}

.search-result-title mark {
    padding: 0 2px;
    background: rgba(199, 149, 66, 0.24);
    color: inherit;
    border-radius: 4px;
}

.search-result-meta {
    display: grid;
    gap: 3px;
    margin-top: 8px;
    color: var(--admin-muted);
    font-size: 0.86rem;
    line-height: 1.6;
}

.search-result-meta mark {
    padding: 0 2px;
    background: rgba(199, 149, 66, 0.2);
    color: var(--admin-primary);
    border-radius: 4px;
}

.search-result-actions {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
    padding-top: 2px;
}

.search-result-actions button,
.detail-action-btn,
.relation-chip {
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-actions button {
    padding: 6px 10px;
    background-color: #e9f4ef;
    color: var(--admin-primary);
}

.search-result-actions button:hover,
.detail-action-btn:hover,
.relation-chip:hover {
    background-color: var(--admin-primary);
    color: #fff;
}

.btn {
    padding: 10px 16px;
    background-color: #eadcc6;
    color: var(--admin-primary);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background-color: var(--admin-primary);
    color: #fff;
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    transform: none;
}

.btn:disabled:hover {
    background-color: #eadcc6;
    color: var(--admin-primary);
}

.view-toolbar {
    display: grid;
    gap: 12px;
    margin: 18px 0;
    padding: 14px;
    background: rgba(255, 253, 248, 0.86);
    border: 1px solid rgba(232, 223, 208, 0.88);
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(45, 37, 24, 0.07);
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-label {
    flex: 0 0 70px;
    color: var(--admin-muted);
    font-size: 0.9rem;
}

.view-switch,
.view-actions,
.canvas-tools {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.view-switch {
    padding: 4px;
    border: 1px solid var(--admin-line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.72);
}

.view-switch-btn {
    padding: 9px 18px;
    background: transparent;
    color: var(--admin-primary);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-switch-btn.active {
    background: var(--admin-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(36, 92, 79, 0.18);
}

.density-btn {
    margin-left: 6px;
}

.canvas-tools {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;
    padding: 5px;
    background: rgba(255, 253, 248, 0.94);
    border: 1px solid var(--admin-line);
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(45, 37, 24, 0.12);
    backdrop-filter: blur(10px);
}

.zoom-btn {
    padding: 8px 12px;
}

.zoom-value {
    min-width: 52px;
    color: var(--admin-primary);
    font-size: 0.9rem;
    text-align: center;
}

.generation-nav {
    display: flex;
    gap: 8px;
    position: sticky;
    top: 12px;
    z-index: 25;
    margin: 0 0 16px;
    padding: 10px;
    background: rgba(255, 253, 248, 0.9);
    border: 1px solid rgba(232, 223, 208, 0.88);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(45, 37, 24, 0.06);
    backdrop-filter: blur(10px);
    overflow-x: auto;
}

.generation-nav-item {
    flex: 0 0 auto;
    padding: 8px 13px;
    background: #f7f0df;
    color: var(--admin-primary);
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.92rem;
}

.generation-nav-item:hover {
    background: var(--admin-primary);
    color: #fff;
}

.generation-nav-item.active {
    background: var(--admin-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(36, 92, 79, 0.18);
}

.family-tree-frame {
    position: relative;
    width: 100%;
}

.family-tree {
    width: 100%;
    padding: 32px;
    background: rgba(255, 253, 248, 0.94);
    border: 1px solid rgba(232, 223, 208, 0.9);
    border-radius: 24px;
    box-shadow: var(--admin-shadow);
    overflow: auto;
    margin-bottom: 24px;
    min-height: calc(100vh - 310px);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.family-tree.dragging {
    cursor: grabbing;
}

.tree {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: max-content;
    zoom: var(--tree-zoom, 1);
}

.tree.generation-view {
    display: block;
    width: 100%;
    min-width: 0;
    zoom: 1;
}

.tree ul {
    display: flex;
    padding: 20px 0;
    position: relative;
    transition: all 0.5s;
}

.tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
    transition: all 0.5s;
}

.tree li::before,
.tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid var(--admin-primary);
    width: 50%;
    height: 24px;
    z-index: 0;
}

.tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid var(--admin-primary);
}

.tree > ul > li::before,
.tree > ul > li::after {
    display: none;
}

.tree li:only-child::before,
.tree li:only-child::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-top: 2px solid var(--admin-primary);
    width: 0;
    height: 24px;
    z-index: 0;
}

.tree li:only-child::after {
    border-left: 2px solid var(--admin-primary);
    border-radius: 5px 0 0 0;
}

.tree li:only-child::before {
    border-left: 0 none;
}

.tree li:only-child::after {
    border-right: 0 none;
}

.tree li:first-child::before {
    border: 0 none;
}

.tree li:last-child::after {
    border: 0 none;
}

.tree li:last-child::before {
    border-right: 2px solid var(--admin-primary);
    border-radius: 0 5px 0 0;
}

.tree li:first-child::after {
    border-left: 2px solid var(--admin-primary);
    border-radius: 5px 0 0 0;
}

.tree li:only-child:first-child::before,
.tree li:only-child:last-child::after {
    border: 0 none;
}

.tree li:only-child:first-child::after {
    border-left: 2px solid var(--admin-primary);
}

.tree li:only-child:last-child::before {
    border-right: 2px solid var(--admin-primary);
}

.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid var(--admin-primary);
    width: 0;
    height: 20px;
    z-index: 0;
}

.tree ul ul.single-child::before {
    height: 44px;
}

.tree ul ul.single-child > li:only-child::before,
.tree ul ul.single-child > li:only-child::after {
    display: none;
}

.tree ul.single-child > li:only-child {
    padding-left: 0;
    padding-right: 0;
}

.tree-node {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    margin: 0 auto;
    text-align: center;
    cursor: pointer;
    transition: transform 0.25s ease;
}

.tree-node:hover {
    transform: scale(1.04);
}

.avatar-container {
    width: 82px;
    height: 82px;
    margin: 0 auto 10px;
    position: relative;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--admin-success);
    background-color: #f6eddd;
    overflow: hidden;
    transition: all 0.3s ease;
    object-fit: cover;
}

.name-tag {
    background-color: var(--admin-primary);
    color: white;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.9em;
    position: relative;
    margin-top: 5px;
    white-space: nowrap;
}

.tree-node:hover .avatar {
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(36, 92, 79, 0.28);
}

.generation-container {
    width: 100%;
    margin-bottom: 28px;
    scroll-margin-top: 16px;
}

.generation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--admin-line);
}

.generation-header h2 {
    display: inline-flex;
    align-items: center;
    margin: 0;
    color: var(--admin-primary);
    font-size: 1.35rem;
}

.generation-count {
    display: inline-flex;
    margin-left: 10px;
    color: var(--admin-muted);
    font-size: 0.9rem;
}

.generation-toggle {
    padding: 7px 12px;
    background: #f7f0df;
    color: #806331;
    border: 1px solid var(--admin-line);
    border-radius: 999px;
    cursor: pointer;
}

.generation-toggle:hover {
    background: var(--admin-primary);
    color: #fff;
}

.generation-members {
    display: contents;
}

.generation-members-sparse {
    grid-template-columns: repeat(auto-fill, minmax(300px, 420px));
    justify-content: start;
}

.generation-branches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    align-items: stretch;
    justify-content: stretch;
}

.generation-branch {
    display: contents;
}

.generation-branch-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
    width: fit-content;
    margin-top: 4px;
    padding: 6px 11px;
    background: #f7f0df;
    color: #806331;
    border: 1px solid var(--admin-line);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.86rem;
    transition: all 0.18s ease;
}

.generation-branch-title::after {
    content: '收起';
    color: var(--admin-muted);
    font-size: 0.78rem;
}

.generation-branch-title.collapsed::after {
    content: '展开';
}

.generation-branch-title:hover {
    background: var(--admin-primary);
    color: #fff;
}

.generation-branch-title:hover::after {
    color: rgba(255, 255, 255, 0.78);
}

.generation-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 270px;
    min-height: 270px;
    padding: 22px;
    background: rgba(255, 253, 248, 0.96);
    border: 1px solid rgba(232, 223, 208, 0.92);
    border-radius: 22px;
    box-shadow: 0 10px 28px rgba(45, 37, 24, 0.07);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.generation-card::after {
    content: '';
    position: absolute;
    top: -42px;
    right: -42px;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    background: rgba(36, 92, 79, 0.07);
}

.generation-card:hover,
.generation-card:focus {
    border-color: rgba(199, 149, 66, 0.48);
    box-shadow: 0 16px 36px rgba(45, 37, 24, 0.12);
    outline: none;
    transform: translateY(-2px);
}

.generation-card.highlight {
    animation: generation-card-pulse 0.55s ease-in-out 3;
}

.generation-card.located {
    border-color: var(--admin-gold);
    box-shadow: 0 16px 38px rgba(199, 149, 66, 0.18);
}

.tree-node.located .avatar {
    border-color: var(--admin-gold) !important;
    box-shadow: 0 0 0 4px rgba(199, 149, 66, 0.2);
}

@keyframes generation-card-pulse {
    0%, 100% {
        border-color: rgba(232, 223, 208, 0.92);
        box-shadow: 0 10px 28px rgba(45, 37, 24, 0.07);
        transform: translateY(0);
    }

    50% {
        border-color: var(--admin-gold);
        box-shadow: 0 18px 40px rgba(199, 149, 66, 0.24);
        transform: translateY(-3px);
    }
}

.generation-card-header {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.generation-card-avatar {
    width: 58px;
    height: 58px;
    border: 3px solid var(--admin-success);
    border-radius: 16px;
    background: #f6eddd;
    object-fit: cover;
}

.generation-card-title {
    min-width: 0;
}

.generation-card-title h3 {
    margin: 0 0 6px;
    color: var(--admin-primary-strong);
    font-size: 1.32rem;
    line-height: 1.2;
}

.generation-status {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
}

.generation-status.status-alive {
    background: #e8f5f5;
    color: var(--admin-success);
}

.generation-status.status-deceased {
    background: #f0f0f0;
    color: #666;
}

.generation-status.status-unknown {
    background: #f7f0df;
    color: #806331;
}

.generation-card-arrow {
    color: #a5aaa8;
    font-size: 1.7rem;
}

.generation-card-relations {
    display: grid;
    gap: 8px;
    align-content: start;
    min-height: 64px;
    max-height: 64px;
    margin-bottom: 10px;
    overflow: hidden;
}

.generation-card-meta {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    color: var(--admin-muted);
    font-size: 0.92rem;
}

.generation-card-meta-label {
    color: var(--admin-muted);
}

.generation-card-meta-value {
    min-width: 0;
    display: -webkit-box;
    line-height: 1.55;
    padding-bottom: 2px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.generation-link {
    padding: 1px 3px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--admin-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: all 0.18s ease;
}

.generation-link:hover {
    background: #edf6f2;
    color: var(--admin-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.generation-card-separator,
.generation-card-more {
    color: var(--admin-muted);
}

.generation-card-bio {
    display: -webkit-box;
    margin: 0 0 12px;
    color: #6f756e;
    line-height: 1.55;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.generation-card-life {
    flex: 0 0 auto;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #f2eadc;
    color: var(--admin-muted);
    font-size: 0.94rem;
}

.tree.generation-compact .generation-branches {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.tree.generation-compact .generation-members {
    display: contents;
}

.tree.generation-compact .generation-members-sparse {
    grid-template-columns: repeat(auto-fill, minmax(260px, 360px));
    justify-content: start;
}

.tree.generation-compact .generation-card {
    height: 200px;
    min-height: 0;
    padding: 16px;
    border-radius: 18px;
}

.tree.generation-compact .generation-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
}

.tree.generation-compact .generation-card-header {
    gap: 10px;
    margin-bottom: 10px;
}

.tree.generation-compact .generation-card-title h3 {
    margin-bottom: 4px;
    font-size: 1.12rem;
}

.tree.generation-compact .generation-card-bio {
    display: none;
}

.tree.generation-compact .generation-card-life {
    padding-top: 10px;
}

.tree.generation-compact .generation-card-relations {
    min-height: 58px;
    max-height: 58px;
    margin-bottom: 10px;
}

.tree.generation-compact .generation-card-meta-value {
    -webkit-line-clamp: 1;
}

footer {
    text-align: center;
    padding: 18px;
    color: var(--admin-muted);
    font-size: 0.9em;
}

.auth-state {
    width: min(560px, 100%);
    margin: 15vh auto;
    padding: 32px;
    background: rgba(255, 253, 248, 0.94);
    border: 1px solid var(--admin-line);
    border-radius: 24px;
    box-shadow: var(--admin-shadow);
    text-align: center;
}

.auth-state h1 {
    margin-bottom: 10px;
    color: var(--admin-primary);
}

.auth-state p {
    color: var(--admin-muted);
}

.drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    visibility: hidden;
    transition: visibility 0.3s ease;
}

.drawer.open {
    visibility: visible;
}

.drawer-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(36, 31, 24, 0.52);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer.open .drawer-overlay {
    opacity: 1;
}

.drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 94vw);
    max-width: 94vw;
    background: var(--admin-card);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer.open .drawer-content {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: flex-end;
    padding: 15px;
    background-color: #f8f2e8;
    border-bottom: 1px solid var(--admin-line);
}

.drawer-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--admin-muted);
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
}

.drawer-close:hover {
    color: var(--admin-ink);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 26px 30px 32px;
}

.detail-avatar-container {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
}

.detail-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--admin-success);
    object-fit: cover;
}

.detail-avatar.deceased {
    border-color: #808080;
    opacity: 0.7;
}

.detail-avatar.unknown {
    border-color: var(--admin-gold);
    opacity: 0.85;
}

.detail-name {
    text-align: center;
    color: var(--admin-primary-strong);
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.detail-status {
    text-align: center;
    margin-bottom: 20px;
}

.detail-status .status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
}

.detail-status .status-alive {
    background-color: #e8f5f5;
    color: var(--admin-success);
}

.detail-status .status-deceased {
    background-color: #f0f0f0;
    color: #666;
}

.detail-status .status-unknown {
    background-color: #f7f0df;
    color: #806331;
}

.detail-info {
    border-top: 1px solid var(--admin-line);
    padding-top: 20px;
}

.detail-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.detail-action-btn {
    padding: 10px 18px;
    background-color: #f7f0df;
    color: #806331;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f2eadc;
}

.detail-row-stack {
    align-items: flex-start;
}

.detail-label {
    flex: 0 0 112px;
    color: var(--admin-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

.detail-value {
    flex: 1;
    min-width: 0;
    color: var(--admin-ink);
    font-size: 1rem;
    line-height: 1.8;
}

.detail-value.clickable {
    color: var(--admin-primary);
    cursor: pointer;
}

.detail-value.clickable:hover {
    text-decoration: underline;
}

.detail-relations,
.detail-children {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.relation-chip,
.detail-children .child-item {
    display: inline-block;
    background-color: #e8f5f5;
    color: #264653;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.92rem;
    cursor: pointer;
}

.relation-separator {
    color: #a5aaa8;
}

.detail-children .child-item:hover {
    background-color: var(--admin-primary);
    color: #fff;
}

.tree-node.highlight {
    animation: highlight-pulse 0.5s ease-in-out 3;
}

@keyframes highlight-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    header {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .family-stats {
        white-space: normal;
    }

    .header-side {
        justify-content: flex-start;
        width: 100%;
    }

    .user-menu {
        align-items: flex-start;
        border-radius: 18px;
        flex-wrap: wrap;
    }

    .view-toolbar {
        padding: 12px;
    }

    .toolbar-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar-label {
        flex: none;
    }

    .canvas-tools {
        top: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
        border-radius: 18px;
    }

    .generation-nav {
        margin-bottom: 12px;
        padding: 8px;
    }

    .generation-nav-item {
        padding: 7px 11px;
        font-size: 0.86rem;
    }

    .search-result-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .family-tree {
        padding: 20px;
        min-height: 520px;
    }

    .generation-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .generation-branches,
    .tree.generation-compact .generation-branches {
        grid-template-columns: 1fr;
    }

    .generation-card {
        height: auto;
        min-height: 0;
        padding: 18px;
    }

    .tree.generation-compact .generation-card {
        height: auto;
    }

    .avatar-container {
        width: 60px;
        height: 60px;
    }

    .name-tag {
        font-size: 0.8em;
        padding: 4px 10px;
    }

    .drawer-content {
        width: 100%;
        max-width: 100vw;
    }

    .drawer-body {
        padding: 20px;
    }

    .detail-avatar-container {
        width: 100px;
        height: 100px;
    }

    .detail-name {
        font-size: 1.5rem;
    }

    .detail-row {
        flex-direction: column;
        gap: 8px;
    }

    .detail-label {
        flex: none;
    }
}
