/* --- Nine Kinship Chart Styles --- */
.wpft-nine-kinship-chart-container {
    font-family: 'SimSun', '宋体', serif;
    border: 2px solid #8B4513;
    padding: 15px;
    background-color: #FFF8DC;
    max-width: 100%; /* Increased max-width for better layout */
    margin: 20px auto;
    text-align: center;
    overflow-x: auto; /* Allow horizontal scrolling if content overflows */
}
.wpft-nine-kinship-controls { /* Styles for the new controls */
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: flex;
    flex-direction: column; /* 新增：将主轴改为垂直方向 */
    align-items: stretch;   /* 新增：让子项宽度撑满容器 */
    gap: 10px;
    margin-left: auto;
    margin-right: auto;
}
.wpft-nine-kinship-controls .wpft-form-group {
    flex-grow: 1; /* Allow select to take available space */
    margin-bottom: 0;
}
.wpft-nine-kinship-person-select {
    width: 100% !important; /* Ensure Select2 takes full width of its container */
}
.wpft-nine-kinship-generate-button {
    flex-shrink: 0; /* Prevent button from shrinking */
    padding: 8px 15px !important;
    line-height: normal !important;
    height: auto !important;
}

.wpft-kinship-header {
    margin-bottom: 20px;
}
.wpft-kinship-header h2 {
    font-size: 28px;
    color: #8B4513;
    margin-bottom: 10px;
    font-weight: bold;
}
.wpft-kinship-legend {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}
.wpft-kinship-legend span {
    margin: 0 10px;
    display: inline-block;
}
.wpft-kinship-legend p {
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

.wpft-kinship-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(100px, 1fr)); /* Min width for cells */
    gap: 3px; /* Reduced gap */
    border: 1px solid #D2B48C;
    min-width: 400px; /* Ensure grid has a minimum width before scrolling */
}

.wpft-kinship-cell {
    border: 1px solid #DEB887;
    padding: 6px 4px; /* Reduced padding */
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background-color: #FAF0E6;
    font-size: 13px; /* Slightly smaller base font */
    line-height: 1.2;
    box-sizing: border-box;
    position: relative; /* For positioning Fuhuku label */
}
.wpft-kinship-cell.empty {
    background-color: #F5F5DC;
    border-color: #EEE8AA;
}
.wpft-kinship-cell.self {
    /* self class implies fuhuku-1, color handled by .fuhuku-1 */
    font-weight: bold;
    border-width: 2px;
}
.wpft-kinship-cell.static-line .kinship-generation-label {
    font-size: 11px;
    color: #777;
    margin-bottom: 0; /* Adjusted for Fuhuku label */
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 16px; /* Space for Fuhuku label */
}
.wpft-kinship-cell.static-line .kinship-term {
    font-weight: normal;
    font-size: 13px; /* Match other terms */
}
.wpft-kinship-cell.daughter-cell {
    /* You can add specific styles here if needed */
}

.kinship-fuhuku-text-label {
    font-size: 1em;
    color: #444;
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0);
    padding: 0px 3px;
    border-radius: 2px;
    line-height: 1.1;
    z-index: 1;
    font-weight: normal;
    white-space: nowrap;
}

.kinship-term {
    font-weight: bold;
    color: #A0522D;
    margin-bottom: 4px;
    font-size: 14px; /* Slightly smaller term */
    display: block;
    width: 100%;
    min-height: 18px;
    flex-shrink: 0; /* Prevent term from shrinking */
    margin-top: 16px; /* Space for Fuhuku label, if no generation label */
}
.wpft-kinship-cell.static-line .kinship-term {
    margin-top: 2px; /* Less margin if generation label is also present */
}


.kinship-names-wrapper {
    width: 100%;
    flex-grow: 1; /* Allow wrapper to take remaining space */
    max-height: 80px; /* Adjust for scrollbar visibility */
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 12px;
    text-align: center;
    scrollbar-width: thin;
    scrollbar-color: #D2B48C #FAF0E6;
    padding-top: 2px; /* Small space above names */
}
.kinship-names-wrapper::-webkit-scrollbar {
    width: 5px;
}
.kinship-names-wrapper::-webkit-scrollbar-track {
    background: #FAF0E6;
    border-radius: 3px;
}
.kinship-names-wrapper::-webkit-scrollbar-thumb {
    background-color: #D2B48C;
    border-radius: 3px;
}
a.kinship-name {
    display: block;
    color: #000080;
    text-decoration: none;
    padding: 1px 0; /* Reduced padding */
    white-space: nowrap;
}
a.kinship-name:hover {
    text-decoration: underline;
    color: #FF4500;
}
.kinship-name.no-data {
    color: #888;
    font-style: italic;
}

/* Fuhuku Color Coding (matching the image) */
.wpft-kinship-cell.fuhuku-1 { background-color: #fff !important; border-color: #FFCDD2 !important; }
.wpft-kinship-cell.fuhuku-1 .kinship-fuhuku-text-label { color: #C62828; }

.wpft-kinship-cell.fuhuku-2 { background-color: #fbb715 !important; border-color: #FFE0B2 !important; }
.wpft-kinship-cell.fuhuku-2 .kinship-fuhuku-text-label { color: #E65100; }

.wpft-kinship-cell.fuhuku-3 { background-color: #5cb85c !important; border-color: #C5CAE9 !important; }
.wpft-kinship-cell.fuhuku-3 .kinship-fuhuku-text-label { color: #3F51B5; }

.wpft-kinship-cell.fuhuku-4 { background-color: #03c8d4 !important; border-color: #C8E6C9 !important; }
.wpft-kinship-cell.fuhuku-4 .kinship-fuhuku-text-label { color: #2E7D32; }

.wpft-kinship-cell.fuhuku-5 { background-color: #fb15159c  !important; border-color: #B3E5FC !important; }
.wpft-kinship-cell.fuhuku-5 .kinship-fuhuku-text-label { color: #0277BD; }

.wpft-kinship-cell.out-of-fuhuku {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
}
.wpft-kinship-cell.out-of-fuhuku .kinship-term,
.wpft-kinship-cell.out-of-fuhuku .kinship-names-wrapper a.kinship-name,
.wpft-kinship-cell.out-of-fuhuku .kinship-fuhuku-text-label {
    color: #6c757d;
}
.wpft-kinship-cell.self { border-color: #DAA520 !important; } /* Self border can be distinct */

/* Ensure combined descendant cells have appropriate styling if needed */
.wpft-kinship-cell.combined-descendant .kinship-term {
    /* Styles for labels like "儿女", "孙子(女)" if they need to be different */
}
--- END OF FILE style-nine-kinship.css ---