.kinship-page .container {
    min-height: 0;
    padding-bottom: 1.5rem;
}

.kinship-page .header {
    margin-bottom: 1.5rem;
}

.kinship-info {
    margin-top: 0.5rem;
}

.kinship-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.kinship-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.toggle-group {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 0.4rem 0.875rem;
    font-size: 0.875rem;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toggle-btn.active {
    background: #fff;
    color: #4f46e5;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.chain-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    background: #fff;
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    padding: 0.25rem 0.5rem 0.25rem 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chain-input-wrap:focus-within {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.chain-prefix {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #4f46e5;
    white-space: nowrap;
    flex-shrink: 0;
}

.chain-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.75rem 0.5rem;
    font-size: 1.0625rem;
    color: #111827;
    background: transparent;
    min-width: 0;
}

.chain-input::placeholder {
    color: #9ca3af;
    font-size: 0.9375rem;
}

.chain-input-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.icon-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.icon-action-btn:hover:not(:disabled) {
    background: #e5e7eb;
    color: #374151;
}

.icon-action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.relation-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

.relation-btn {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    font-size: 0.9375rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

.relation-btn:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    background: #eef2ff;
}

.relation-btn:active {
    transform: scale(0.97);
}

.canvas-section {
    margin-bottom: 1.25rem;
}

.canvas-title {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.canvas-wrap {
    background: linear-gradient(180deg, #fafbff 0%, #f8fafc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 220px;
}

#kinshipCanvas {
    display: block;
    min-width: 100%;
}

.result-display {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(160deg, #f8faff 0%, #f0f4ff 50%, #faf5ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    min-height: 5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-label {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.result-text {
    font-size: 2rem;
    font-weight: 700;
    color: #4338ca;
    line-height: 1.3;
}

.result-text.empty {
    font-size: 1rem;
    font-weight: 400;
    color: #9ca3af;
}

.result-alt {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6366f1;
}

.action-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.action-btn {
    flex: 1;
    min-width: 100px;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.action-btn-clear {
    background: #fef2f2;
    color: #dc2626;
}

.action-btn-clear:hover {
    background: #fee2e2;
}

.action-btn-copy {
    background: #eef2ff;
    color: #4f46e5;
}

.action-btn-copy:hover:not(:disabled) {
    background: #e0e7ff;
}

.action-btn-copy:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.examples-section {
    margin-top: 0.25rem;
}

.examples-title {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.625rem;
}

.examples-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.example-chip {
    border: 1px dashed #d1d5db;
    background: #f9fafb;
    border-radius: 999px;
    padding: 0.35rem 0.875rem;
    font-size: 0.8125rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s ease;
}

.example-chip:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    background: #eef2ff;
}

@media (max-width: 640px) {
    .relation-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .result-text {
        font-size: 1.5rem;
    }

    .kinship-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .chain-prefix {
        font-size: 1rem;
    }

    .chain-input {
        font-size: 1rem;
    }
}
