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

        body {
            font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #1a0a00 0%, #2d1810 50%, #1a0a00 100%);
            min-height: 100vh;
            color: #fff;
            overflow-x: hidden;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }

        header {
            text-align: center;
            margin-bottom: 20px;
        }

        header h1 {
            font-size: 2.2rem;
            font-weight: 700;
            background: linear-gradient(90deg, #d4a574, #f5e6cc, #d4a574);
            background-size: 200% auto;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: gradient-shift 3s ease infinite;
            margin-bottom: 8px;
        }

        @keyframes gradient-shift {
            0%, 100% { background-position: 0% center; }
            50% { background-position: 200% center; }
        }

        header .subtitle {
            font-size: 1rem;
            color: rgba(212, 165, 116, 0.6);
            font-weight: 300;
        }

        .controls {
            display: flex;
            justify-content: center;
            gap: 12px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 25px;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            color: #fff;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
        }

        .btn:active {
            transform: translateY(0);
        }

        .btn-reset {
            background: linear-gradient(135deg, #5d4037, #795548);
        }

        .btn-zoom-in {
            background: linear-gradient(135deg, #4e342e, #6d4c41);
        }

        .btn-zoom-out {
            background: linear-gradient(135deg, #3e2723, #5d4037);
        }

        .btn-toggle {
            background: linear-gradient(135deg, #bf360c, #d84315);
        }

        .btn-fullscreen {
            background: linear-gradient(135deg, #00695c, #00897b);
        }

        .btn-filter {
            background: linear-gradient(135deg, #4527a0, #5e35b1);
        }

        #graph-container {
            width: 100%;
            height: 75vh;
            min-height: 600px;
            background: rgba(255, 255, 255, 0.03);
            border-radius: 20px;
            border: 1px solid rgba(212, 165, 116, 0.15);
            backdrop-filter: blur(10px);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
            position: relative;
            overflow: hidden;
        }

        #graph-container:fullscreen {
            width: 100vw;
            height: 100vh;
            min-height: 100vh;
            border: 0;
            border-radius: 0;
            background: linear-gradient(135deg, #1a0a00 0%, #2d1810 50%, #1a0a00 100%);
        }

        /* 全屏模式下确保SVG可以接收鼠标事件 */
        :fullscreen svg {
            pointer-events: auto !important;
        }

        :fullscreen .node {
            pointer-events: auto !important;
            cursor: pointer !important;
        }

        :fullscreen .link {
            pointer-events: auto !important;
        }

        /* 全屏模式下隐藏家族筛选和tooltip */
        :fullscreen .house-filter,
        :fullscreen .tooltip,
        body.graph-fullscreen .house-filter,
        body.graph-fullscreen .tooltip {
            display: none !important;
        }

        /* 全屏模式下不需要特殊处理模态框的display，因为它由JS控制active类 */

        .tooltip {
            position: absolute;
            padding: 12px 16px;
            background: rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(212, 165, 116, 0.3);
            border-radius: 8px;
            font-size: 0.85rem;
            color: #fff;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease;
            z-index: 100;
            max-width: 300px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        }

        .tooltip.visible {
            opacity: 1;
        }

        .tooltip .tooltip-name {
            font-weight: 700;
            font-size: 1rem;
            color: #d4a574;
            margin-bottom: 4px;
        }

        .tooltip .tooltip-house {
            font-size: 0.8rem;
            color: rgba(255, 255, 255, 0.5);
            margin-bottom: 8px;
            font-style: italic;
        }

        .tooltip .tooltip-connections {
            font-size: 0.8rem;
            color: rgba(255, 255, 255, 0.7);
            line-height: 1.5;
        }

        /* D3 SVG styles */
        .link {
            stroke-width: 2px;
            transition: stroke 0.3s ease, stroke-width 0.3s ease;
        }

        .link.parent-child {
            stroke: rgba(76, 175, 80, 0.4);
        }

        .link.spouse {
            stroke: rgba(233, 30, 99, 0.4);
            stroke-dasharray: 5, 5;
        }

.link.relation {
    stroke: rgba(255, 193, 7, 0.45);
    stroke-dasharray: 2, 6;
}

        .link.highlighted {
            stroke-width: 3px;
            stroke: #ffd740 !important;
            stroke-dasharray: none;
        }

        .link.dimmed {
            stroke: rgba(255, 255, 255, 0.05) !important;
        }

        .node circle {
            stroke-width: 2px;
            cursor: grab;
            transition: fill 0.3s ease, r 0.3s ease;
        }

        .avatar-image {
            pointer-events: none;
        }

        .node circle:active {
            cursor: grabbing;
        }

        .node text {
            font-size: 11px;
            text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.7);
            pointer-events: none;
            font-weight: 500;
        }

        .edge-label {
            font-size: 9px;
            text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
            pointer-events: none;
        }

        /* House filter panel */
        .house-filter {
            position: absolute;
            top: 20px;
            left: 20px;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(10px);
            padding: 15px 20px;
            border-radius: 12px;
            border: 1px solid rgba(212, 165, 116, 0.2);
            z-index: 10;
        }

        .house-filter h3 {
            font-size: 0.95rem;
            margin-bottom: 12px;
            color: #d4a574;
        }

        .house-filter label {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
            font-size: 0.82rem;
            color: rgba(255, 255, 255, 0.8);
            cursor: pointer;
        }

        .house-filter input[type="checkbox"] {
            accent-color: #d4a574;
        }

        .house-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            display: inline-block;
        }

        /* Modal styles */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.75);
            backdrop-filter: blur(5px);
            z-index: 10000;
            display: none;
            justify-content: center;
            align-items: center;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        /* 全屏模式下模态框使用绝对定位，确保覆盖整个屏幕且不影响SVG交互 */
        :fullscreen .modal-overlay {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100vw !important;
            height: 100vh !important;
            z-index: 10000 !important;
            pointer-events: none !important;
        }

        /* 只有当模态框激活时才接收鼠标事件 */
        :fullscreen .modal-overlay.active {
            pointer-events: auto !important;
        }

        .modal-overlay.active {
            display: flex;
            opacity: 1;
        }

        .modal-content {
            background: linear-gradient(135deg, #2d1810 0%, #1a0a00 100%);
            border: 1px solid rgba(212, 165, 116, 0.3);
            border-radius: 16px;
            padding: 30px;
            max-width: 550px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
            position: relative;
            transform: scale(0.9);
            transition: transform 0.3s ease;
        }

        .modal-overlay.active .modal-content {
            transform: scale(1);
        }

        .modal-close {
            position: absolute;
            top: 15px;
            right: 20px;
            font-size: 1.5rem;
            color: rgba(212, 165, 116, 0.6);
            cursor: pointer;
            background: none;
            border: none;
            transition: color 0.2s ease;
        }

        .modal-close:hover {
            color: #d4a574;
        }

        .modal-header {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid rgba(212, 165, 116, 0.2);
        }

        .modal-avatar {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
            box-shadow: 0 0 15px rgba(212, 165, 116, 0.3);
            background-size: cover;
            background-position: center;
            border: 3px solid rgba(255, 255, 255, 0.85);
        }

        .modal-title h2 {
            font-size: 1.3rem;
            color: #d4a574;
            margin-bottom: 4px;
        }

        .modal-title .modal-subtitle {
            font-size: 0.85rem;
            color: rgba(255, 255, 255, 0.5);
            font-style: italic;
        }

        .modal-body {
            line-height: 1.8;
            color: rgba(255, 255, 255, 0.85);
            font-size: 0.95rem;
        }

        .modal-body p {
            margin-bottom: 12px;
            text-align: justify;
        }

        .modal-quote {
            margin-top: 20px;
            padding: 15px 20px;
            background: rgba(212, 165, 116, 0.1);
            border-left: 3px solid #d4a574;
            border-radius: 0 8px 8px 0;
            font-style: italic;
            color: rgba(212, 165, 116, 0.8);
            font-size: 0.9rem;
        }

        /* Node click cursor */
        .node {
            cursor: pointer;
        }

        /* Responsive */
        @media (max-width: 768px) {
            header h1 {
                font-size: 1.5rem;
            }
            
            .controls {
                gap: 8px;
            }
            
            .btn {
                padding: 8px 14px;
                font-size: 0.85rem;
            }
            
            #graph-container {
                height: 60vh;
            }
            
            .house-filter {
                display: none;
            }
        }
